static variable vs non static variable

前端 未结 4 872
遥遥无期
遥遥无期 2020-12-20 08:37

I have defined an object and declared a static variable i. In the get() method, when I try to print the instance and class variable, both print the

4条回答
  •  再見小時候
    2020-12-20 09:18

    static is a class level variable and non static is an instance variable(object level variable) . So here you declare only static variable and call them different way but same meaning.

    this.i
    test.i
    

    both treated as class level variable or static variable.

提交回复
热议问题