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
Does printwriter create a file?
What is a boolean structure?
Can we overload run() method in java?
What is bufferedreader in java?
What is the association?
How many times finalize method will be invoked? Who invokes finalize() method in java?
Give an example of call be reference significance.
What are scalar data types?
How to split a string in java?
What is length in java?
How to perform binary search in java?
What is boolean keyword in java?
What is a loop java?
Why do we use return statement?
Why main() method is public, static and void in java ?