Question: I ONLY NEED HELP WITH PART G Program 1 : Write a Java program (name it StringMethods) that reads from the user two strings (say

I ONLY NEED HELP WITH PART G

Program 1 : Write a Java program (name it StringMethods) that reads from the user two strings (say string1, and string2). Use String class methods to manipulate these strings as follows. Read all input before printing the results

a) Determine the length of string1. --FINISHED THIS

b) Determine the length of string2. --FINISHED THIS

c) Concatenate string1 with string2 (use a String Class method, not the overloaded "+" operator). --FINISHED THIS

d) Check if the two strings have same set of characters with regard to case (i.e., equal).-- FINISHED THIS

e) Convert string1 to upper case.--FINISHED THIS

f) Convert string2 to lower case. --FINISHED THIS

g) Extract a valid sub-string of multiple characters from string1. (Appropriately handle the case that string1 does not have enough characters to extract a valid substring of multiple characters.) -

-QUESTION ABOUT PART G: I'm wondering if a "valid substring of multiple characters" can be equal to the original string?

Example---- string1 = Da

can a "valid substring of multiple characters" be equal to "Da"? (substring = Da)

or can a "valid substring" not equal the original string? if that is the case, then the string length must be >= 3 ... or if it can be equal to the original string, then the string length only needs to be >= 2 ... please help me define what a "valid" substring is. I know a "proper substring" cannot equal the original string, but does "valid" mean proper?

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!