public class PrintWay {
String name="dq";
String type;
public PrintWay(){
this.name="李华";
this.type="无";
}
public PrintWay(String name){
this.name=name;
}
public PrintWay(String name, String type) {
this.name = name;
this.type = type;
}
public void print(){
System.out.print(this.name,this.type);
}
}
这里为什么会报错呢?应该要怎么调用定义的变量?求解
System.out.print(name + ", " + type);
【相关推荐】
在jsp中我使用了这样的语句
<html>
<body>
<h2>Hello World!</h2>
<%
out.print("hello sk1y");
%>
</body>
</html>
但是out.print中的print是红色的,且提示我Cannot resolve method 'print(java.lang.String)'
但是我跑这个程序的时候,没问题,仍然能够显示出hello sk1y