We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String title = scanner.nextLine();
String author = scanner.nextLine();
int price = scanner.nextInt();
scanner.close();
Book book = new MyBook(title, author, price);
book.display();
}
}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Day 13: Abstract Classes
You are viewing a single comment's thread. Return to all comments →
import java.util.*;
abstract class Book { String title; String author;
}
class MyBook extends Book{ int price; MyBook(String title, String author,int price){ super(title,author); this.price=price;
}
public class Solution {
}