Menu
Question Index
...

What will be the output of the following program?

interface Fan {
    short counter = 0;
    void countUp(int k);
}
public class AirConditioner implements Fan {
    public static void main(String[] args) {
        AirConditioner t = new AirConditioner();
        t.countUp(counter);
    }
    public void countUp(int k) {
        for (int x = 6; x > k; x--, ++k) {
            System.out.print(k + " ");
        }
    }
}


0 1 2
1 2 3
0 1 2 3
1 2 3 4
Compilation Error or Runtime Error

Doubts

Problems

Topic: Creating Interface In Java With Example Program

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App