• Spring
  • Servlet
  • PHP
  • Struts
  • SQL Tutorial
  • Java IO
  • jQuery
  • RubyonRails
  • JSP

  • <

    Java Abstract Method Tutorial

    Abstract keyword is used to declare abstract in java class.You can not create object in abstract class.

    Abstract method can only use is abstract class.

    Java Abstract Example

    We use Abstraction to hiding the implementation details and showing only functionality to the user.


    Java Abstract Example


    abstract class Bike{  
      abstract void run();   
    }   
    
    class Honda4 extends Bike{   
    void run(){System.out.println("running safely..");
    }   
    public static void main(String args[]){   
     Bike obj = new Honda4();   
     obj.run();   
    }   
    }  
    

    OUTPUT:
    running safely..
    















    © copyright 2017-2022 Completedone pvt ltd.