Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Go to http://download.oracle.com/javase/8/docs/api/ Use the API for the String c

ID: 3741717 • Letter: G

Question

Go to http://download.oracle.com/javase/8/docs/api/

Use the API for the String class (java.lang.String) to answer the following questions. Assume that string1 and string2 are variables declared as type String. Also assume that num is an int variable. Write a complete Java statement as an answer for each question:

1- How can you create a new string from the 1st character to the 9th character of a string?

2- How can you create a new string from the 3rd character to the 7th character of a string?

3- How can you create a new string from the 5th character to the end of a string?

4- How can you join two strings together into a new string?

Explanation / Answer

1. string1.substring(0, 9); 2. string1.substring(2, 7); 3. string1.substring(4); 4. string1.concat(string2);

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote