package first;

public class for_protect {
    private int age=10;
    int number = 100;
    public void show(){
        System.out.println(number);
        System.out.println(this.number=1000);
        System.out.println(this.number);
        //private的变量用this
        //static变量用类名.变量
        //public 直接表示或this.number
    }
    public static void main(String args[]){
        for_protect test = new for_protect();
        test.show();
    }
}

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-07
  • 2021-12-09
  • 2021-05-27
  • 2021-12-09
  • 2021-07-07
  • 2021-04-21
猜你喜欢
  • 2022-12-23
  • 2022-01-18
  • 2021-12-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案