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
Explain implementation and how is it different from conversion?
What is a byte string?
What is included in core java?
What are the procedures?
How many types of variables are there?
What is heterogeneous in java?
What is the role of garbage collector in java?
How many ways can we create the string object?
How do you check if a number is a perfect square?
What is polymorphism and what are the types of it?
What is merge sort in java?
What does += mean in java?
What is a jagged array in java?
What is string args [] in java?
How do you add an element to an arraylist in java?