public class Person {String name;int age;String school;String major;public Person(String n,int a) { name=n; age=a;}public Person(String n,int a,String s) { name=n; age=a; school=s;}public Person(String n,int a,String s,String m) { name=n; age=a; school=s; major=m;}}class TestPerson{ public static void main(String[]args) { Person one=new Person("花花",15,"中学","体育"); System.out.println(one.name,one.age,one.school,one.major); }}它提示我这个错误 怎么解决 感谢The method println(int) in the type PrintStream is not applicable for the arguments (String, int, String, String)
3 回答
已采纳
qq_清影无痕_0
TA贡献10条经验 获得超3个赞
提示说的很清楚了,println这个方法不支持多参数,用逗号分隔相当于添加了多个参数,如果想实现输出,就把几个变量合成一个就可以了,字符串与整数可以直接用加号进行合并
添加回答
举报
0/150
提交
取消