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));
You may compose there in an electronic file of any form (i.e. text, word processing, PDF,, etc.). When complete, deliver your file to Homework 6 Practice dropbox in the eLearning site.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started