面向对象高级static :修饰成员方法,应用场景

image

 

image

 

image

 

image

 

 

 

image

image

 

image

 

image

 1,如果类方法一定要访问实例成员:

  1. 创建本类对象,对象。实例变量 / 对象。实例方法(最常用) 例如 Text  a = new Text    
  2. 如果你不想 new 对象:把这个成员改成 static(变成类成员,不推荐随便改)

 

posted @ 2026-09-01 01:43  白了过去  阅读(14)  评论(0)    收藏  举报