This week's book giveaway is in the Java in General forum.
We're giving away four copies of Helidon Revealed: A Practical Guide to Oracle’s Microservices Framework and have Michael Redlich on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

subClass methods ?

 
Ranch Hand
Posts: 5399
1
Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
here is a Que from Maha's mock test
33. Consider the classes defined below:

Which of the following are legal method declarations to add to the class Sub? Assume that each method is the only one being added.
a) public static void main( String args[] ){}
b) float methodTwo(){}
c) long methodOne( int c, long d ){}
d) int methodOne( int c, long d ) throws ArithmeticException{}
e) int methodOne( int c, long d ) throws FileNotFoundException{}
I think answer is
a) as it is our pet main() method
b) as it is overloading super class's method
d) as it is throwing unchecked Exception and I checked it it compiles fine.
e) as FileNotFoundException is subClasss of IOE.
AND
c) can not be as return type is different.
but evalution page says that ans is WRONG.. and page which contains answer is not available.
so plz ane1 can tell what is the answer for the above question
CMIW
TIA
 
Ranch Hand
Posts: 732
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
lets leave this one for Valentin or Rob to answer but im with u Kumar on this one .
c is wrong the rest are correct in my opinion.
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How kind of you Roy
You got the right answers...
Anyone else?
 
R K Singh
Ranch Hand
Posts: 5399
1
Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Valentin Crettaz:

You got the right answers...


Hi Val
then why it is giving WRONG
coz my other que, also I was thinking that answer might be wrong(Errata) but after discussing here I found that I was wrong.... Though I still say that above given ans is correct in my knowledge but then WHY it is giving "WRONG"???
TIA
 
Valentin Crettaz
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It says WRONG because because you don't have all right answers. Let's say correct answers are a, b and c. If you don't answer that, then the verdict will be WRONG, that is even if you answer a,b,c,d you'll get wrong...
Now from what I see in the HTML page source code, the correct answers are a,b and e. So I don't know why she doesn't count d as a correct option...
Anyone else ?
 
R K Singh
Ranch Hand
Posts: 5399
1
Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
so we can assume it to be error ... what ever Typo, etc....
so ans is a b d e
CMIW
Thanks
 
The only taste of success some people get is to take a bite out of you. Or this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic