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
List the features of java programming language.
What is a concrete classes? Is Java object class is concrete class?
What are recursive functions? Give some examples?
How does indexof work?
What is the class in java?
Why is it called a string?
How big is a boolean?
What is return code?
What is the latest version of java?
Is passing by reference faster?
what is the purpose of the wait(), notify(), and notifyall() methods? : Java thread
What is a locale?
Is the empty set a singleton?
What is bom encoding?
Add a value x to array from index l to r where 0 <= l <= r <= n-1