3 回答

Caballarii
TA贡献1123条经验 获得超629个赞
用双引号包起来就是字符串而不是变量了,但直接System.out.println(SEX1)会找不到变量,因为SEX1是非静态变量。所以要么把SEX1变成静态的,final static char SEX1='男'。要么new了对象再访问,HelloWorld helloWorld=new HelloWorld(); System.out.println(helloWorld.SEX1)

添加回答
举报
0/150
提交
取消