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

How do you define Global variables in Java ?

1 Answer

0 votes
by (46.1k 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;

Related questions

0 votes
1 answer
asked Aug 1, 2019 in Java by Aarav (11.5k points)
+11 votes
2 answers
asked May 26, 2019 in Java by stevie65 (900 points)
0 votes
1 answer
asked Sep 24, 2019 in Java by Anvi (10.2k points)
0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...