0

Can i extends two activity in java and please read description.

Let I have two classes one is main and other is second.If I extends a class app in main class and after that if I extends class main in class second. Will class second have all methods and non-private variable of class main and class app.

17th Oct 2019, 11:04 AM
Devanshu Pathsariya
Devanshu Pathsariya - avatar
3 odpowiedzi
+ 2
Please add Java into the Relevant Tags 👍
17th Oct 2019, 11:16 AM
Ipang
17th Oct 2019, 1:12 PM
id001x
id001x - avatar
0
yes class App { int a=1; String app() {return " app\n";} } class Main extends App { int m=2; String mainx() {return " main\n";} } class Second extends Main { public static void main(String[] args) { new Second().main2();} void main2(){ System.out.println(a+app() +m+mainx()); }}
17th Oct 2019, 1:03 PM
zemiak