+ 2

Can we make a class having implemented methods as an abstract class!?

abstract class Myclass { public static int add(int a,int b) { return a+b; } public static int sub(int a,int b) { return a-b; } }

29th Apr 2019, 7:39 PM
Eshu Kamisetty
Eshu Kamisetty - avatar
5 Answers
+ 8
Do you mean like this? https://code.sololearn.com/cOWJgnMX10gY/?ref=app Just note that abstract methods cannot be static as well.
30th Apr 2019, 3:45 AM
Sonic
Sonic - avatar
+ 5
Notice how in Denise Roßberg 's code the concrete class MyCalc did not even have to be instantiated as the members of the abstract base class were static.
30th Apr 2019, 12:54 AM
Sonic
Sonic - avatar
+ 3
Do you mean something like this? https://code.sololearn.com/cvsrxiYqotGs/?ref=app Eshu Kamisetty Edit: I added an abstract class which extends myClass
29th Apr 2019, 8:11 PM
Denise Roßberg
Denise Roßberg - avatar
+ 2
https://code.sololearn.com/cBpjnoYQ7oaf/?ref=app Please refer my code for answer
30th Apr 2019, 3:43 AM
Eshu Kamisetty
Eshu Kamisetty - avatar
+ 1
I am expecting subclass which implements all methods of abstract class, main method in it. And is the abstract class valid?
30th Apr 2019, 2:20 AM
Eshu Kamisetty
Eshu Kamisetty - avatar