- LearnHowToCode SarkariResult.com Interview Questions and Answers LearnHowToCodeOnline
what is abstract class In java
An abstract class is class that contaions 0 or more abstract methods.

// all the object different implementation of the method abstract class myClass
abstract class Myclass
{
   abstract void calculate(double x);
 
   }
   class Demo1 extends Myclass
   {
     void calculate(double x)
{
   System.out.println("Square="+(x*x));
 
   }
  }

class Demo2 extends Myclass{
      void calculate(double x){
      System.out.println("Square root="+Math.sqrt(x));
   }
}

class Demo3 extends Myclass{
   void calculate(double x){
   System.out.println("Cube="+(x*x*x));
      }
     }
 
class MainClass
{
  public static void main(String[]arr)
{
  Demo1 d1=new Demo1();
  Demo2 d2=new Demo2();
  Demo3 d3=new Demo3();
  d1.calculate(4);
  d2.calculate(5);
  d3.calculate(6);
  }
  }
  

About EasyToCode

I'm Ethan Mariano a software engineer by profession and reader/writter by passion.I have good understanding and knowledge of AngularJS, Database, javascript, web development, digital marketing and exploring other technologies related to Software development.

Featured post

Political Full Forms List

Acronym Full Form MLA Member of Legislative Assembly RSS Really Simple Syndication, Rashtriya Swayamsevak Sangh UNESCO United Nations E...

Powered by Blogger.