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

 
 

Share on Google+Share on Google+
SCJP Module-4 Question-4
Posted on: July 9, 2010 at 12:00 AM
Advertisement
This program given below checks you knowledge of float in Java and shows how the values can be returned in float.

Given the following sample code:

class Example4{
public float Twin(float a, float b) {
return 0F;
}
public int Twin(int a, int b) {
return 0;
} }

Is the above sample code correct ?choose the correct reason  :

1. Incorrect , methods can't have the same name.

2. Incorrect , methods must not use same number of arguments.

3.Correct, method overloading is used.

4.Incorrect ,must use in different class.

Answer :

(3)

Explanation :

In method overloading ,same name methods can have same number of arguments but type must be differnt.

Advertisement

Related Tags for SCJP Module-4 Question-4:


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
 

 

 

DMCA.com