Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (10.2k points)

How do you define Global variables in Java ?

1 Answer

0 votes
by (46k 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.4k 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

Browse Categories

...