This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Mock Exam Errata and the fly likes JQPlus problem .. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Mock Exam Errata
Bookmark "JQPlus problem .." Watch "JQPlus problem .." New topic
Author

JQPlus problem ..

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
What what will :
" hello java guru ".trim();
return ?
1) The line of code will not compile.
2) "hellojavaguru"
3) "hello java guru"
4) "hello java guru "
5) None of the above.
I marked 1 as my answer and I see I was wrong. However, JQPlus says the answer is 3. I ran the program and compiled it and it didn't print ANYTHING .. so wouldn't the answer to the question then be 5?
Veer Batra
Ranch Hand

Joined: Mar 12, 2001
Posts: 35
Perhaps you are making mistake somewhere. I tried and it worked for me and
" hello java guru ".trim(); outputs as "hello java guru"
I tried as under
public class Trim
{
public static void main ( String[] args )
{
System.out.println ( " hello java guru ".trim() );
}
}

So answer 3 is correct.

------------------
Veer
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JQPlus problem ..
 
Similar Threads
Active and Passtive Replica..
default Thread priority
JQplus
Passed SCJP
Question on GC from JQPlus