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
How can you generate random numbers in java?
Difference between static binding and dynamic binding?
What is Classloader in Java?
What do you understand by java virtual machine?
Why is stringbuffer thread safe?
State the significance of public, private, protected class?
What is the old name of java?
What is the functionality of the stub?
Where we write javascript code in html page?
Explain java coding standards for constants?
What is the largest number a double can hold?
Explain the purpose of garbage collection in Java?
What is collection sort in java?
What is string manipulation?
What is a short in java?