Sort by

recency

|

211 Discussions

|

  • + 0 comments

    Using Java

    class MyBook extends Book

    {

    @Override
    void setTitle(String s) {
    
        this.title = s;
    }
    

    }

  • + 0 comments

    It allows you to define abstract methods (methods without implementation) that must be implemented by its subclasses, as well as concrete methods (fully defined methods) that subclasses can reuse. www winbuzz com

  • + 0 comments

    Java abstract classes are powerful tools to design flexible and reusable code. They allow developers to define a blueprint for related classes, enforcing specific behaviors (via abstract methods) while sharing common functionality (via concrete methods). Cricbet99 Green

  • + 0 comments

    Here is Java Abstract Class solution - https://programmingoneonone.com/hackerrank-java-abstract-class-problem-solution.html

  • + 0 comments

    import java.util.*; abstract class Book{ String title; abstract void setTitle(String s); String getTitle(){ return title; }

    } final class MyBook extends Book{ void setTitle(String title2){ this.title = title2; } } public class Main{

    public static void main(String []args){
        //Book new_novel=new Book(); This line prHMain.java:25: error: Book is abstract; cannot be instantiated
        Scanner sc=new Scanner(System.in);
        String title=sc.nextLine();
        MyBook new_novel=new MyBook();
        new_novel.setTitle(title);
        System.out.println("The title is: "+new_novel.getTitle());
        sc.close();
    
    }
    

    }