public class B {
B()
{
super();
System.out.println();
}
}
I want to know what is happening in this program it is working fine but there i didnt extended any class
public class B {
B()
{
super();
System.out.println();
}
}
I want to know what is happening in this program it is working fine but there i didnt extended any class
Every class extends Object
- so you're invoking that super()
method. You can see this if you just set a breakpoint in the constructor and step into the super call. Really what you have is :
public class B extends Object {
B()
{
super();
System.out.println();
}
}
Every Class by default extended from Object
class in Java and calling the super()
will call the constructor of Object
class.