ITPub博客

首页 > 应用开发 > > 如图所示 菜单栏的字体在哪设置 系统ubuntu18.0.6

如图所示 菜单栏的字体在哪设置 系统ubuntu18.0.6

作者:limiao 时间:2019-08-13 15:12:32 0 删除 编辑

public class Book {

private String bookname,author,press;

private double money;

//通过构造方法实现属性赋值

public Book(String bookname,String author,String press,double money){

this.bookname=bookname;

this.author=author;

this.setpress(press);

this.setmoney(money);

}

/*通过公有的get/set方法实现属性的访问,其中:

1、限定图书价格必须大于10,如果无效需进行提示,并强制赋值为10

2、限定作者、书名均为只读属性

*/

public String getbookname(){

return bookname;

}

public String getauthor(){

return author;

}

public void setpress(String press){

this.press=press;

}

public String getpress(){

return press;

}

public void setmoney(double money){

if(this.money<10){

System.out.println("图书价格最低10元");

money=10;

}

else this.money=money;

}

public double getmoney() {

return money;

}

//信息介绍方法,描述图书所有信息

public void show(){

System.out.println("书名:"+this.getbookname());

System.out.println("作者:"+this.getauthor());

System.out.println("出版社:"+this.getpress());

System.out.println("价格:"+this.getmoney()+"元");

System.out.println("=======================================");

}

}

 

public class BookText {

Book one=new Book("红楼梦","曹雪芹","人民文学出版社",5);

Book two=new Book("小李飞刀","古龙","中国长安出版社",55.5);

one.show();

two.show();

}

 

在调用show()方法时出现报错,Syntax error on token "show", Identifier expected after this token

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/4549/viewspace-3170128/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: 迭代器的作用
请登录后发表评论 登录
全部评论

注册时间:2019-07-10

  • 博文量
    190
  • 访问量
    1372