aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Wrapper Class. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Wrapper Class." Watch "Wrapper Class." New topic
Author

Wrapper Class.

Bhalotia Kunal
Greenhorn

Joined: May 16, 2005
Posts: 9


can you please explain me which line makes a compile time error.

thanks,
Deepak
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
What happens if you compile the code? What error message do you get? For what line?


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Bhalotia Kunal
Greenhorn

Joined: May 16, 2005
Posts: 9
Hi Barry,

The Answer is...
Compile-time error at 2.
Compile-time error at 4.

Thanks
Deepak
Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026
Ans:2 and 4

Why 2? Because the return type of intValue() is int and not Integer

Why 4?
parseType(String s)

In your example

Integer.parseInt(Integer.valueOf("1").intValue())

Integer.valueOf("1").intValue() return an int. But parseInt()
expects a String as argument so compiler error.


Servlet Spec 2.4/ Jsp Spec 2.0/ JSTL Spec 1.1 - JSTL Tag Documentation
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Good. Now try it with the Java 5.0 compiler.

You will see that this is one of the mock exam questions that gets broken with Java 5.0.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Wrapper Class.