What will the following code print:

public class Funcs extends java.lang.Math {
    public int add(int x, int y) {
        return x + y;
    }
    public int sub(int x, int y) {
        return x - y;
    }
    public static void main(String[] a) {
        Funcs f = new Funcs();
        System.out.println("" + f.add(1, 2));
    }
}

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
Java quizzes
Cosmo
Sign Up Now
or Subscribe for future quizzes