Menu
Question Index
...

What is the output of following program?

public class RiversOverflow {

    public static void main(String[] args) {
        int a = 0;
        int b = 9;
        RiversOverflow ro = null;
        int c = ro.ganga(a, b);
        long d = ro.yamuna(a, b);
        ro = new RiversOverflow();
        long e = ro.ganga(c, d);
        System.out.print("a" + b + "c" + d + "e");
    }

    private static int ganga(int a, int b) {
        System.out.print("a" + b);
        return a + b;
    }

    private static int yamuna(int b, int a) {
        System.out.print(a + "b");
        return a - b;
    }

    private long ganga(int a, long b) {
        System.out.print(a + b);
        return a + b;
    }
}


9909
a99b18a9c9e
a90b0a9c-9e
Some other output
Compilation Error or Runtime Error

Doubts

Problems

Topic: Creating Static Methods In Java Using Static Keyword

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App