i am using eclipse as IDE
i hope its correct now...
class Book{
String title;
String author;
int count;
public Book(){
}
public Book(String title,String author,int count){
this.title=title;
this.author = author;
this.count=count;
}
class Library{
Book [] books;
public Library() {
// TODO Auto-generated constructor stub
}
public Library(Book[] books){
this.books= books;
}
public int getdiffCount(){
int bs=0;
bs = bs +books.length;
System.out.println(bs);
return bs;
}
}
}
public class TestLibrary {
public static void main(String[] args) {
// TODO Auto-generated method stub
Library lib = new Library();
Book book0 = new Book("A","AB",10);
Book book1 = new Book("B","CD",20);
Book book2 = new Book("C","EF",30);
Book book3 = new Book("D","GH",40);
Book [] books ={book0,book1,book2,book3};
int b1 = lib.getCount(book1);
int b2 = lib.getCount("A");
int b3 = lib.getdiffCount();
int b4 = lib.addBook(book3);
System.out.println();
}
}
}