Menu
Question Index
...

What will be the output of the following program?

public class GuessCondition
{
    static int a = 40;
    public static void main(String args[])
    {
        System.out.print(a + " ");
        add();
        System.out.print(a);
    }
    private static void add()
    {
        a = a + 40;
    }
}


40 40
0 0
0 40
40 80
Compilation Error or 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