Find the best answers to your questions at Westonci.ca, where experts and enthusiasts provide accurate, reliable information. Discover in-depth solutions to your questions from a wide range of experts on our user-friendly Q&A platform. Get precise and detailed answers to your questions from a knowledgeable community of experts on our Q&A platform.

Assume myString and yourString are variables of type String already declared and initialized. Write ONE line of code that sets yourString to the first character and the last character of myString added to myString variable.

Sagot :

Answer:

line of code :

newString=myString+myString.charAt(0)+myString.charAt(myString.length()-1);

Explanation:

In Java, the + is used for concatenation

method

charAt() will return the character from the given index from string

myString.charAt(0) will return E

myString.charAt(myString.length()-1)