jQuery in Action, 3rd edition
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 Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Certification » Mock Exam Errata
Bookmark "JQPlus problem .." Watch "JQPlus problem .." New topic

JQPlus problem ..

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.

I agree. Here's the link: http://aspose.com/file-tools
subject: JQPlus problem ..
It's not a secret anymore!