Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * This is called BookSameName as it is showing the use of using methods
- * with the same name on inherited methods. The only difference between
- * this and Book is that putBook() is called put() here.
- */
- class BookSameName
- {
- private String author, title; // initialises the autor and title
- BookSameName(String author0, String title0) // constructor
- {
- author = author0;
- title = title0;
- }
- void put() // print method, this time put() instead of putBook()
- {
- System.out.println(title + " by " + author);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement