Solved

Suppose We Have a String Object Referenced by a Variable

Question 2

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

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents