We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Since this question has been revised, can someone tell me why this is not correct due to the current description? Error information has been included:
class Adder extends Arithmetic {
int add(int one, int two) {
return one + two;
}
}
Error output:
Solution.java:11: error: cannot find symbol
class Adder extends Arithmetic {
^
symbol: class Arithmetic
Solution.java:6: error: cannot find symbol
System.out.println("My superclass is: "+X.getClass().getSuperclass().getName());
^
symbol: method getClass()
location: variable X of type Adder
2 errors
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Java Inheritance II
You are viewing a single comment's thread. Return to all comments →
Since this question has been revised, can someone tell me why this is not correct due to the current description? Error information has been included:
class Adder extends Arithmetic {
int add(int one, int two) { return one + two; }
}
Error output:
Solution.java:11: error: cannot find symbol class Adder extends Arithmetic { ^ symbol: class Arithmetic Solution.java:6: error: cannot find symbol System.out.println("My superclass is: "+X.getClass().getSuperclass().getName());
^ symbol: method getClass() location: variable X of type Adder 2 errors