Dear Arun,
Java does not support the concept of global variables.
However the global variables can be implemented in Java by defining the desired
variables as static members of it. It would be more clear by the following
example.
public class Global
{
public static int x=37;
public static String s="aaa";
}
For implementation of the variables used in above example is
as follows.
public class Globalvartest
{
public static void main(String args[])
{
glob.x=glob.x+100;
glob.s="Hacknology.in";
System.out.println(glob.x);
System.out.println(glob.s);
}
}
EmoticonEmoticon