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) {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
Scanner scan = new Scanner(System.in);
MyBook myBook = new MyBook();
String title = scan.nextLine();
myBook.setTitle(title);
System.out.println("The title is: "+myBook.getTitle());
}
Java Abstract Class
You are viewing a single comment's thread. Return to all comments →
public class Solution {
}
abstract class Book{ String title; abstract void setTitle(String s); String getTitle(){ return title; } }
class MyBook extends Book{ @Override void setTitle(String s){ super.title = s; } }