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
How do you convert boolean to boolean?
When do I need to use reflection feature in java?
Is arraylist dynamic in java?
What are multiple inheritances? Is it supported by java?
Can a class have more than one object?
What is array size in java?
What do you mean by hashing?
Is java programming easy?
What is local class in java?
how do I create a runnable with inheritance? : Java thread
What do you mean by platform independence? What is an interface?
What is instance means in java?
What is the purpose of object oriented programming?
Tell us something about different types of casting?
How the metacharacters are different from the ordinary characters?