Re: mcq



FX wrote:
On May 31, 11:28 pm, "Richard Reynolds" <richiereyno...@xxxxxxxxxxxx>
wrote:

"FX" <tara...@xxxxxxxxx> wrote in message

news:1180634980.089091.106990@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> Given:

1. class Super {
2. public float getNum() { return 3.0f; }
3. }
4.
5. public class Sub extends Super {
6.
7. }
Which method, placed at line6, causes compilation to fail?
A. public void getNum() { }
B. public void getNum(double d) { }
C. public float getNum() { return 4.0f; }
D. public double getNum(float d) { return 4.0d; }

Q: Looking at those particular methods, which ones, placed anywhere, should
get you the sack?

A: all of them!


I tried compiling, all got compiled......
but answer is one of them not all....

The answer is A.
According to Eclipse

Severity and Description Path Resource Location Creation Time Id
The return type is incompatible with test.Super.getNum() test/test test.java line 8 1180644466716 1

.



Relevant Pages

  • Re: mcq
    ... Which method, placed at line6, causes compilation to fail? ... public void getNum() ... public void getNum ...
    (comp.lang.java.programmer)
  • Re: mcq
    ... Which method, placed at line6, causes compilation to fail? ... public void getNum() ... public void getNum ...
    (comp.lang.java.programmer)
  • Re: mcq
    ... public class Sub extends Super { ... Which method, placed at line6, causes compilation to fail? ... public void getNum ...
    (comp.lang.java.programmer)
  • Re: mcq
    ... public class Sub extends Super { ... public void getNum() ... public void getNum ... public double getNum{return 4.0d;} ...
    (comp.lang.java.programmer)
  • mcq
    ... public class Sub extends Super { ... public void getNum() ... public void getNum ... public double getNum{return 4.0d;} ...
    (comp.lang.java.programmer)