Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JQPlus problem ..

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic