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


Share on Google+Share on Google+
SCJP Module-4 Question-1
Posted on: July 9, 2010 at 12:00 AM
The program given below checks you understanding of methods and their declaration. It is also very useful for SCJP examination.

Which code line/lines should be placed at line 6 to run following program ?

1. class Example1{
2. public static void main(String[] args) {
3. Twin(1);
4. Twin(1,2);
5. }
6. // place the code here
7. }

Which statements below can be placed at line 6 to run above program ?

1.    static void Twin(int i ) { }

2.    static void Twin(a,b,c) {  }  

3.     static void Twin(int i, int j) { }

4.    need not to add any code to run this program.

Answer :

(1) & (3)

Explanation :

In Method overloading, same name methods with different number of arguments can be used. Methods must be define before using it.


Related Tags for SCJP Module-4 Question-1:

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 9, 2010

Recommend the tutorial

Advertisements Advertisements