Menu
Question Index
...

What will be the output of the following program?

public class Bowler {
    int runs = 81;
    public static void main(String[] args) {
        new Bowler().go();
    }
    int balls = 75;
    void go() {
        dec(--balls);
        System.out.print(runs + ",");
        System.out.print(balls + ",");
    }
    void dec(int balls) {
        balls -= 20;
        System.out.print(balls + ",");
    }
}


82,54,74,
54,81,74,
82,55,74
54,82,74
Compilation Error or Runtime Error.

Doubts

Problems

Topic: Static and Non Static Variables - Static and Non Static Methods

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App