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
What is locale in java?
What is the purpose of static keyword in java?
Why do we need singleton class?
What is the difference between and ?
What are parameters in a method?
What is the functionality of the stub?
What is Recursion Function?
What is return in java?
hi am an engineering student and my next plan is for ms in either in us or australia i got my passport but i dont know anything bout visa can u give brief idea 1)How to get prepared for visa and 2)How to apply for top universities and 3)How to pay the fee and so on These all are basic questions plz give me a clear idea
Does java have a compiler?
What is data and its types?
Are primitives objects?
What are the major drawbacks of external iteration?
What is a map? What are the implementations of map?
is there a separate stack for each thread in java? : Java thread