Answer Posted / preetesh
There is no term as Global variable in Java.
Types of variable: 1) Local Variable declared within method.
2) Instance Variable declared within class but outside
method.
3) Class Variable
4) Parameters are also treated as variables
Example:
--------
public class Global {
public static int i = 25;
public static String s = "Preetesh";
}
//Such members can be accessed as:
public class Test {
public static void main(String[] args)
{
Global.i = Global.i + 100;
Global.s = "Java";
}
}
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
If system.exit (0); is written at the end of the try block, will the finally block still execute?
Is array primitive data type in java?
What is == in java?
Which sort is best in java?
What happens if we don’t define serial version uid?
What is method overloading with type promotion?
What is size of int in java?
Explain the significance of class loaders in bootstrap?
What are decalarations?
Explain the significance of listiterator.
What is autoboxing and unboxing?
What is a class variable?
How do you sort an array in java?
How do you download stubs from Remote place?
What is the use of default method in interface in java? Explain