this is the error
C:\bbs>javac libmainsys.java
libmainsys.java:43: array required, but int found
ypub[nElems] = new libary(title, author, ypub);
^
1 error
C:\bbs>
// to run this program: C>java libmainsys
////////////////////////////////////////////////////////////////
class libary
{
private String booktitle;
private String bookauthor;
private int yearpub;
//-----------------------------------------------------------
public libary(String title, String author, int ypub)
{ // constructor
booktitle = title;
bookauthor = author;
yearpub = ypub;
}
//-----------------------------------------------------------
public void displaylibary()
{
System.out.print(" Book Title: " + booktitle);
System.out.print(", Book Author: " + bookauthor);
System.out.println(",Year Publisher : " + yearpub);
}
public String getLast() // get title
{ return booktitle; }
} // end class libary
2007-01-22
02:21:04
·
2 answers
·
asked by
Anonymous