Skip to main content
added 3 characters in body
Source Link
J. Chomel
  • 8.4k
  • 15
  • 44
  • 72

Calling contructorconstructor from another constructor

class MyConstructorDemo extends ConstructorDemo { MyConstructorDemo() { this("calling another constructor"); } MyConstructorDemo(String arg) { System.out.print("This is passed String by another constructor :"+arg); } } 

Also you can call parent constructor by using super()super() call

Calling contructor from another constructor

class MyConstructorDemo extends ConstructorDemo { MyConstructorDemo() { this("calling another constructor"); } MyConstructorDemo(String arg) { System.out.print("This is passed String by another constructor :"+arg); } } 

Also you can call parent constructor by using super() call

Calling constructor from another constructor

class MyConstructorDemo extends ConstructorDemo { MyConstructorDemo() { this("calling another constructor"); } MyConstructorDemo(String arg) { System.out.print("This is passed String by another constructor :"+arg); } } 

Also you can call parent constructor by using super() call

Source Link
Akshay Gaikwad
  • 460
  • 1
  • 6
  • 13

Calling contructor from another constructor

class MyConstructorDemo extends ConstructorDemo { MyConstructorDemo() { this("calling another constructor"); } MyConstructorDemo(String arg) { System.out.print("This is passed String by another constructor :"+arg); } } 

Also you can call parent constructor by using super() call