Home Tutorial Java Scjp Part4 SCJP Module-4 Question-17


Share on Google+Share on Google+
SCJP Module-4 Question-17
Posted on: July 10, 2010 at 12:00 AM
The program given below test your aptitude of Inheritance and method overloading and prepare you for SCJP exam.

Given the following sample code:

         void Twin(int a, float b) { System.out.println("Hello ");}

class SubExample3 extends Example3{
         public void Twin(int a, float b)throws java.io.IOException        
              System.out.println("Hello "); }

How can you correct above code ?

1. By removing the "throws" clause.

2. By changing the type of arguments of overriding  method.

3. By increasing the number of arguments.

4. Correction is not needed.

Answer :


Explanation :

"IOException" is not compatible with "throws" clause .


Related Tags for SCJP Module-4 Question-17:

Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: July 10, 2010

Recommend the tutorial

Advertisements Advertisements