Java OCA OCP Practice Question 399

Question

What will the following statement return?

"    hello java developer   ".trim (); 

Select 1 option

  • A. The line of code will not compile.
  • B. hellojavadeveloper
  • C. "hello java developer"
  • D. "hello java developer "
  • E. None of the above


Correct Option is  : C

Note

A. is a wrong answer.

" hello java developer " is a valid String and trim () is a valid method in String class.

B. is a wrong answer.

trim () does not remove spaces in within the string but the spaces at the beginning and at the end.




PreviousNext

Related