0 votes
1 view
in Java by (5.5k points)

How do you define Global variables in Java ?

1 Answer

0 votes
by (33.2k points)

To mark Global Variable you can obtain control of static Keyword

public class Example {

    public static int a;

    public static int b;

}

now you can obtain a and b from everywhere by requesting

Example.a;

Example.b;

...