Question: Practice Answer the following questions in a text or word processing file. Given the following declaration for a String object named aString, identify what is

Practice

Answer the following questions in a text or word processing file.

Given the following declaration for a String object named aString, identify what is assigned to the given variable or object for each string operation A-H. You can of course execute the code yourself if you wish. If the given operation would produce an exception or error, note that instead.

String aString = new String("Delta College - CST 183");

A. String string1 = aString.substring(9,12);

B. int location1 = aString.indexOf("CST");

C. char char1 = aString.charAt(21);

D. int location2 = aString.lastIndexOf("e");

E. String string2 = aString.substring(20,24);

F. boolean result1 = aString.endsWith("College");

G. boolean result2 = Character.isLetterOrDigit(aString.charAt(14));

H. boolean result3 = Character.isDigit(aString.charAt(20));

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!