public class Book {
private String title;
private int id;
private static int count = 0;
private int time;
public Book(String title, int id) {
this.time = time;
this.title = title;
this.id = id;
count += 1;
}
public String toString() {
return title + ", " + id;
}
public static int getBookCount() {
return count;
}
public static long addBook(String title, int id) {
long start = System.nanoTime(); // Get the current system time in nanoseconds
Book[0] = new Book(title, id);
while (start < 10000000000){
}
else {
}
return (end - start); // Return the difference between the start and end times
}
public static void main(String[] args) {
public static Book[] books = new Book [2];
for (Book book : books) { // Use Foreach syntax to iterate over array
System.out.println(book); // this is same as book.toString()
}
System.out.println("Libary Book Count: " + Book.getBookCount());
}
}
Book.main(null);
public class Novel extends Book{
private String author;
private int year;
public static String getAuthor(){
return author;
}
public static int getYear(){
return year;
}
public static void setAuthor(String author){
this.author = author;
}
public static void setYear(int year){
this.year = year;
}
}
public class Textbook extends Book{
private String Company;
private String subject;
public static String getCompany(){
return Company;
}
public static String getSubject(){
return subject;
}
public static void setCompany(String Company){
this.Company = Company;
}
public static void setSubject(String Subject){
this.subject = subject;
}
}