• + 0 comments

    `Optimal solution for this problem | Easy to Understand

    abstract class Book{
       abstract void setBooktitle(String s);
    }
    class MyBook extends Book{
        @Override
        void setBooktitle(String s){
            System.out.println("The title is: " + s);
        }
    }
    
    public class Solution {
    
        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 sc = new Scanner(System.in);
            String str = sc.nextLine();
            MyBook book = new MyBook();
            book.setBooktitle(str);
    
        sc.close();
    }
    

    } `