answersLogoWhite

0


Best Answer

A superclass constructor is the constructor of the superclass.

Constructor is a special method that runs automatically as soon as a method is instantiated (created).

Superclass is the class on which a certain class is based. This is what is known as "inheritance" - classes can be based on other classes. This is done as a way of organizing classes, and for code reuse - that is, reducing the amount of duplicate code.

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is super class construter?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

How is a constructor in the super class called?

By using the reference super(); When you invoke super(); the JVM knows that you are trying to invoke the constructor from the parent class and calls the super class constructor automatically. In fact, the invocation to super(); is usually the first line of any class constructor. This is done to ensure that all the parent class objects are initialized before the current child class is created.


Which Abstract class is the super class for reading bytes?

java.io.InputStream


What portions of a super class can be used by subclass?

Any members of a superclass which are declared as public or protected can be used by all subclasses.


Is it possible to have a method in the super class and sub class with same name but different signature?

Yes, it is perfectly possible. If two methods have a different signature, they can exist together irrespective of where they are present, either in the same class or in a super class, sub class situation. If two methods have the same signature and one exists in the super class and one in the sub class it is called method overriding.


How super class variable can be used to refer the sub class object?

The super variable is not a reference to a subclass. It is a reference to the superclass. class MyClass { void printType() { System.out.println("This is a MyClass"); } // MySubClass is a subclass of MyClass. Within this class, the super keyword // refers to MyClass. static class MySubClass extends MyClass { void printType() { // Tell Java we also want to call the printType method of the super class super.printType(); System.out.println("This is a MySubClass"); } } }

Related questions

What is the difference between Mario Construter Forever and Mario Worker?

Mario Construter Forever has a lots of items then Mario Worker


How do you invoke an overwritten super class from the sub class?

super


Is inheritence in java only based on super class and sub class?

Yes. Inheritance is achieved by using the super class and sub class concept


How is a constructor in the super class called?

By using the reference super(); When you invoke super(); the JVM knows that you are trying to invoke the constructor from the parent class and calls the super class constructor automatically. In fact, the invocation to super(); is usually the first line of any class constructor. This is done to ensure that all the parent class objects are initialized before the current child class is created.


What is object class in java?

object class is a super class for all other class...


How can you access the super class variables with out any object creation?

Variables of the super class can be accessed using the super keyword. Here is an example. class A { int a; } class B extends A { int a; public B() { super.a = 5; } }


What are the applications of super and this keyword?

The super and this keywords are mainly used in case of inheritance. this - refers to the object of the current class instance super - refers to the object of the instance of the parent class of the current class.


Which Abstract class is the super class for reading bytes?

java.io.InputStream


What portions of a super class can be used by subclass?

Any members of a superclass which are declared as public or protected can be used by all subclasses.


How do you invoke an overwritten super class method from the sub class?

super.methodHere();


Is it possible to have a method in the super class and sub class with same name but different signature?

Yes, it is perfectly possible. If two methods have a different signature, they can exist together irrespective of where they are present, either in the same class or in a super class, sub class situation. If two methods have the same signature and one exists in the super class and one in the sub class it is called method overriding.


How super class variable can be used to refer the sub class object?

The super variable is not a reference to a subclass. It is a reference to the superclass. class MyClass { void printType() { System.out.println("This is a MyClass"); } // MySubClass is a subclass of MyClass. Within this class, the super keyword // refers to MyClass. static class MySubClass extends MyClass { void printType() { // Tell Java we also want to call the printType method of the super class super.printType(); System.out.println("This is a MySubClass"); } } }