Can a class extend abstract class or interface? why

Answer Posted / swapna

Yes, a class can extends an abstract class.A class can
implement an interface not to extend an interface.
In abstract class can consist method signature not method's
defenation. Through class we can define the methods
defenation by using public access specifier. In class we
can override the methods of abstract class by using public
access specifiers. Same think will happen in also interface
case . B'coz we cannot directly create object of abstract
class and interface.
Ex:
abstract class A
{
abstract void show();
}
class B extends A
{
public void show()
{
System.out.println ("Hello java");
}
}
public class AbstA {

public static void main (String[] args)
{
B b=new B();
b.show();
}

}
out put: Hello java

Is This Answer Correct ?    17 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the purpose of final keyword and when to use it?

629


Can list be final in java?

585


What is immutable state?

603


What does t in java mean?

620


What are the four pillars of java?

737






Is it possible to define a method in java class but provide it’s implementation in the code of another language like c?

679


What does you mean in math?

633


What is factor r?

628


what is enumset?

673


What is a private class in java?

600


What is the method in java?

722


What are the 7 types of characters?

679


How are the elements of a gridbaglayout organized?

644


How does predicate work in java?

645


What is variable and example?

602