You are viewing a single comment's thread. Return to all comments →
In Java 15,
import java.io.; import java.util.;
class Arithmetic {
int add(int a, int b) { return a+b; }
}
class Adder extends Arithmetic {
public class Solution {
public static void main(String[] args) { Adder adder = new Adder(); System.out.println("My superclass is: " + adder.getClass().getGenericSuperclass().getTypeName()); System.out.println(adder.add(30,12) + " " + adder.add(10,3) + " " + adder.add(15,5)); }
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 →
In Java 15,
import java.io.; import java.util.;
class Arithmetic {
}
class Adder extends Arithmetic {
}
public class Solution {
}