Can a class inherit the constructors of its superclass?
Answer Posted / gayathri
import java.io.*;
class Parent
{
Parent()
{
System.out.println("This is super class Constructor");
}
}
class Code3 extends Parent
{
Code3()
{
System.out.println("This is child class");
}
public static void main(String ar[])
{
Code3 c=new Code3();
}
}
Here if i call the child class constructor,even the parent class constructor is implicitly invoked,that means constructors can be inherited.
| Is This Answer Correct ? | 2 Yes | 2 No |
Post New Answer View All Answers
What is a java predicate?
What is binary tree in java?
Why scanner is used in java?
Explain what is encapsulation?
how to create multithreaded program? Explain different ways of using thread? When a thread is created and started, what is its initial state? : Java thread
What does system out println () do?
what is the significance of listiterator in java?
What is keyword in oop?
What technique is carried out to find out if a particular string is empty?
What is consumer interface?
What is the file type?
Tell me are there implementations for sorting and searching in the java libarary?
What is autoboxing in java?
What does bitwise or mean?
What is the major difference between linkedlist and arraylist?