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
Where can i get Latest SUN Certification Dumps and what are the Sun Certification Codes that are available, Im new to JAVA, so please gimme info as i need to write J2EE - Core Java Certification
What the difference is between execute, execute Query, execute Update?
What is difference between java and java ee?
What are keywords in java?
What is a parameter in java?
What does int [] mean in java?
What is string builder in java?
Which types of exceptions are caught at compile time?
What is hotjava?
Who is founder of java?
How does a for loop work?
What is java virtual machine and how it is considered in context of java’s platform independent feature?
Which is better list or arraylist in java?
Can a static class have a constructor?
What string is utf8?