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
Given a singly linked list, determine whether it contains a loop or not without using temporary space?
What is polymorphism java example?
What is tree node in java?
What are the advantages of java inner classes?
What is the functionability stubs and skeletons?
what is the purpose of using rmisecuritymanager in rmi?
Which eclipse is best for java?
What is the primitive type byte?
What are the access modifiers available in java?
What does replaceall do in java?
What is an empty list in java?
What is an empty class? What functionality does it offer in Java?
What is the difference between class forname and new?
What is the use of keywords in java?
Why is stringbuffer thread safe?