1 USING THE FOLLOWING CLIENT CLASS WRITE THE CLASS BOOK publ
1. USING THE FOLLOWING CLIENT CLASS WRITE THE CLASS BOOK.
public class BookClient { public static void main(String[] args)
{
Book b = new Book (\"Harry Potter and the Goblet of Fire\", \"J. K. Rowling\", \"074666\"); b.display();
}
}
Solution
import java.util.*;
import java.lang.String;
public class BookClient{
public static void main(String[] args)
{
Book b = new Book (\"Harry Potter and the Goblet of Fire\", \"J. K. Rowling\", \"074666\");
b.display();
}
}
// creating Book class
class Book {
// this instance variable is visible for any child class.
public String Bookname;
public String AuthorName;
public String bookId;
//The variable are assigned in the constructor.
public Book(String name,String Author, String Id){
Bookname = name;
AuthorName=Author;
bookId=Id;
}
// This display() method prints the Book details
public void display(){
System.out.println(\"\ Book Details are:\\t\");
System.out.println(\"Book Name: \"+Bookname);
System.out.println(\"AuthorName: \"+AuthorName);
System.out.println(\"BookId: \"+bookId);
}
}
***************** output**********************
Book Details are:
Book Name: Harry Potter and the Goblet of Fire
AuthorName: J. K. Rowling
BookId: 074666
*************************
![1. USING THE FOLLOWING CLIENT CLASS WRITE THE CLASS BOOK. public class BookClient { public static void main(String[] args) { Book b = new Book (\ 1. USING THE FOLLOWING CLIENT CLASS WRITE THE CLASS BOOK. public class BookClient { public static void main(String[] args) { Book b = new Book (\](/WebImages/5/1-using-the-following-client-class-write-the-class-book-publ-982794-1761504640-0.webp)