wood burning stoves 2.0*
The moose likes Mock Exam Errata and the fly likes a doubt in mindQ Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Mock Exam Errata
Bookmark "a doubt in mindQ" Watch "a doubt in mindQ" New topic
Author

a doubt in mindQ

Kishore Pamu
Ranch Hand

Joined: Mar 18, 2001
Posts: 35
Consider the classes defined below:
import java.io.*;
class Super
{
int methodOne( int a, long b ) throws IOException
{ // code that performs some calculations
}
float methodTwo( char a, int b )
{ // code that performs other calculations
}
}
public class Sub extends Super
{
}
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 want to know the answer for this question.
i think it is b,d,e.but iam confused .

Kishore
Avinash Rai
Ranch Hand

Joined: Apr 26, 2001
Posts: 40
Answers a,b,d,e are correct.
Main method will be present in every class.
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Kish,
Just to elaborate on Avinash's answers:
A. (Correct)All classes can have a main method
B. (Correct)Signature is unique (i.e., doesn't override any method)
C. (InCorrect)Signature is same as parent methodOne but return type is incorrect.
D. (Correct)ArithmeticException is an unchecked exception (RunTimeException)
E. (Correct)FileNotFoundException is a subclass of IOException.
Regards,
Manfred.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: a doubt in mindQ
 
Similar Threads
re; MindQ test question
MindQ question 33 - throwing ArithmeticException
A question from MindQ
A question in MindQ
Overriding and overwriting