我的任务的问题是:
创建一个名为Book.java的java文件,该文件将包含描述Book的信息.所需信息是:
a)作者
b)标题
c)出版商
d)出版年份
e)页数
为每条信息使用适当的数据类型.该类将需要每个变量的构造函数,getter和setter方法,以及一个打印Book的描述的toString方法.
我继续收到错误,指出未定义构造函数书.有想法该怎么解决这个吗?
class Book {
String author;
String title;
String publisher;
int year;
int pages;
/** The following methods are the Getters for
* Author
* title
* number of pages
* year of publication
*/
public String getTitle()
{
return title;
}
public String getAuthor()
{
return author;
}
public int getPages()
{
return pages;
}
public int getYear()
{
return year;
}
//:::::::::::::::::::::::::::::::::::::::::::::::
/**the following Methods are Setters for
* Author …Run Code Online (Sandbox Code Playgroud)