+ 10

Could I use inheritance to call another class constracter

22nd Jan 2019, 9:08 AM
Aram Saleem
Aram Saleem - avatar
4 Answers
+ 9
I realize yes we can use inherite
1st Feb 2019, 4:57 PM
Aram Saleem
Aram Saleem - avatar
+ 4
Base class ctor is automatically called when you create object of derived class... But if you want to call it in another manner, use super();
22nd Jan 2019, 9:20 AM
Elva
Elva - avatar
+ 2
class A { A() { System.out.println("hello A's constructer"); } } class B extends A { public static void main(String args[]) { A a = new A(); } } you can use like this. i think you mean this?
2nd Feb 2019, 11:22 AM
Kavindu Gayantha
Kavindu Gayantha - avatar
0
I think that we can use inheritence
4th Feb 2019, 3:00 PM
Daw Sandar Htun
Daw Sandar Htun - avatar