Question
StringMethods.java Write a complete Java program to perform these tasks (5 points): Assign a string variable, s1, to New York City Assign a second string
StringMethods.java Write a complete Java program to perform these tasks (5 points): Assign a string variable, s1, to "New York City" Assign a second string variable, s2, to "New Orleans" Assign the first character of s1 to a char variable ch Assign the substring of s1 from index 4 to 8 to a third string variable, s3 Create a fourth string variable, s4, that stores s3 in uppercase Assign the index of "Yo" from s1 to an integer variable called x Assign the index of "Yo" from s3 to an integer variable called y. Assign the last index of 'e' in s2 to an integer variable called z. Assign the sum of x, y and z to an integer variable called sum. Assign the substring of s2 from index 6 to the end of the string to a fifth string variable called s5 Assign the concatenation of s3 and s5 to a sixth string variable called s6. Assign the concatenation of s6 and the first word of s2 to a seventh string variable called s7. Display : s1 s2 s3 s4 s5 s6 s7 x y z sum ch
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