Solved

Suppose We Have a String Object Referenced by a Variable

Question 26

Multiple Choice

Suppose we have a String object referenced by a variable called listing. Suppose we want a new String object that consists of the first 5 characters in listing. Which of the following lines of code will achieve this?


A) String prefix = listing.front(5) ;
B) String prefix = listing.front(6) ;
C) String prefix = listing.substring(1,5) ;
D) String prefix = listing.substring(0,5) ;
E) String prefix = listing.firstChars(5) ;

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions