Home Tutorial Java Scjp Part9 SCJP Module-9 Question-25

 
 

Share on Google+Share on Google+
SCJP Module-9 Question-25
Posted on: July 19, 2010 at 12:00 AM
Advertisement
The Sample example given below will check your common knowledge of Java program and its flow.

Given below the sample code :

import java.util.*;
public class MyClass{
public static Object Mymethod(List lst) {
return lst.get(0);
}
}

Which code line will run after adding it to the above code ?

1. Object a = MyClass.Mymethod(new LinkedList());

2. Object a = MyClass.Mymethod(new LinkedList<?>());

3. String str = MyClass.Mymethod(new LinkedList<String>());

4. Object a = MyClass.Mymethod(new LinkedList<Object>());

5. String str = (String)MyClass.Mymethod(new LinkedList<String>());

Answer

(1),(4)&(5)

Advertisement

Related Tags for SCJP Module-9 Question-25:


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

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com