java: 无法从静态上下文中引用非静态 变量 this

liandaozhanshi / 2023-06-03 / 原文

 

 造成这个错误的原因有两个

1、把Teacher类定义成静态类

2、把Teacher和Test类分开