0
global variables
like we got global variables in C language which can be operated throughout all user define functions, do we have any such thing in java that run in all the method of the class.?
3 Answers
+ 1
Yes, define the variable outside of any methods. I believe the section on encapsulation covers this.
+ 1
Define a static variable inside any class .
Examples:
public static int age;
public static final String FILENAME="data.txt";
0
wrong