Menu
Topics Index
...
`

Interface1376


If you need explanation Read this topic

If you need Answer Take test on this topic

Interface1376
What will be the output of the following program?
interface Common {
    short counter = 0;
    void countUp();
    void countUp(int k);
}
public class Finish implements Common {
    public static void main(String[] args) {
        Finish t = new Finish();
        t.countUp(counter);
    }
    public void countUp(int k) {
        for (int x = 6; x > k; x--, ++k) {
            System.out.print(k + " ");
        }
    }
}

A. 0 1 2
B. 1 2 3
C. 0 1 2 3
D. Compilation Error
E. Runtime Error 
Topic: Creating Interface In Java With Example Program

If you need explanation Read this topic

If you need Answer Take test on this topic

User comments below. All of them might not be correct.

Ans is D...becoz Finish is not abstract and does not override abstract method countup(int) in common

Posted by Sneha Rapool    2014-02-24 13:31:53


ans is D,bcoz an implementing class should  implement all the methods which are in the interfae.

Posted by Raviteja Daggupati    2014-02-24 13:52:16


Congratulations Raviteja Daggupati. You are this dose winner. We will send you the link using which you can claim your recharge.

Posted by Merit Campus    2014-02-25 04:41:49


© meritcampus 2019

All Rights Reserved.

Open In App