Global variables in Java

后端 未结 24 1875
青春惊慌失措
青春惊慌失措 2020-11-22 11:56

How do you define Global variables in Java ?

24条回答
  •  渐次进展
    2020-11-22 12:38

    very simple:

    class UseOfGlobal
    {
    private static int a;
    private static int b;
    }
    

    but it is always good to have local variables defined inside method blocks where ever possible.

提交回复
热议问题