Please click on ads

Please click on ads

Thursday, 11 February 2021

abstract in java

hey,

today we are create an abstract class and run the programe

 package abstract2;

abstract class motors{

public abstract void sound();

public abstract void name();

public  String person="ankush";

}

class abs extends motors{

public void sound() {

System.out.println("tuut tuut!");

}

public void name() {

System.out.println("volvo");

}

}

public class abstract2  {


public static void main (String [] args) {

abs q=new abs();

q.sound();

q.name();

System.out.println(q.person);

}

}


No comments:

Post a Comment