Menu
Question Index
...

What will be the output of the following program?

public class Vinayak {
    static int laddu = 4;
    final static String TRUTH = "GaneSh iS soO great";
    static String trunk = "";
    static float mouse = 12.0f;
    public static void main(String[] args) {
        ganesh();
        ganesh();
        ganesh();
        ganesh();
        ganesh();
        ganesh();
        System.out.println(trunk);
    }
    public static void ganesh() {
        vignesh(laddu);
        switch (laddu) {
            case 5 * 3 :
            case 18 :
                laddu -= 3;
                break;
            case 10 :
                laddu = 2;
                break;
            default :
                laddu = 1;
                break;
            case 2 :
                laddu = 0;
        }
    }
    public static void vignesh(int i) {
        trunk += i;
    }
}


411111
422222
Compilation Error
Runtime Error

Doubts

Problems

Topic: Static Keyword In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App