public class tong
{
private String author;
private String title;
private int piece;
public tong(String author,String title,int piece)
{
System.out.println("书名:"+this.author);
System.out.println("作者:"+this.title); //构造函数里可以有这些语句的存在吗?
System.out.println("价格:"+this.piece);
}
public static void main(String[] args)
{
tong t1=new tong("林","JAVA人门",50);
t1.tong(); //这里出现了错误
}
}
请指教。。。谢谢 |
|