| 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.
|
 |
 |
|
|
subject: Wrapper Class.
|
|
|