Answer Posted / satish
Direct global variables are not possible like
int i=0;
class{
....
....
}
But other way is create a class with static variables and
you can use it wherever needed.
class Global{
public static int i;
public static String s="";
}
class SomeClass{
public static void main(String args[]){
Global.i=23;
Global.s="Whats up"
}
}
| Is This Answer Correct ? | 6 Yes | 2 No |
Post New Answer View All Answers
Describe the process as to how substring() methodology mechanisms in java.
What is a line break?
How do you remove duplicates from an array in java?
What is 16 bits called?
Differece between class and generic class?
What is keyword and identifier?
How many bytes is a url?
Is string a class in java?
What is charat java?
Explain the Propertie sof class?
What is pre increment and post increment in java?
What is difference between call by value and call by reference?
Why we override equals() method?
What does this mean java?
What is the main difference between java platform and other platforms?