Get the answers you need at Westonci.ca, where our expert community is always ready to help with accurate information. Ask your questions and receive precise answers from experienced professionals across different disciplines. Our platform provides a seamless experience for finding reliable answers from a network of experienced professionals.

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)