Ques:
**
- Create a class Library'
- Have main method in it.
- Inside main method, create an instance called'book'. 4, Usung'book', reference, call a method called' read (300).
- In read (int pages) method, return pages. 6 Store returned values as pa
- Print pa in main method.**
Input:
public class Library
{
public static void main(String[]args)
{
Library book=new Library();
book.read();
book.page(300);
}
public void read()
{
System.out.println("read");
}
public void page(int no1)
{
System.out.println(300);
}
}
Output:
Top comments (0)