Words.java 2 import java.util.Scanner; 3 4 public class Words 5 { public static void main(String[] args) 6. { Scanner in = new Scanner(System.in); String word = in.next(); 8 9. 10 word.charAt(0); char...


Complete this program so that it prints the given word with the first and last character interchanged. For example, if word is “tool”, then produce “loot”.  Avoid Loops


Words.java<br>2 import java.util.Scanner;<br>3<br>4 public class Words<br>5 {<br>public static void main(String[] args)<br>6.<br>{<br>Scanner in = new Scanner(System.in);<br>String word = in.next();<br>8<br>9.<br>10<br>word.charAt(0);<br>char first =<br>11<br>String last = word.substring (word.length()-1);<br>12<br>System.out.println(word);<br>13<br>14<br>15 }<br>

Extracted text: Words.java 2 import java.util.Scanner; 3 4 public class Words 5 { public static void main(String[] args) 6. { Scanner in = new Scanner(System.in); String word = in.next(); 8 9. 10 word.charAt(0); char first = 11 String last = word.substring (word.length()-1); 12 System.out.println(word); 13 14 15 }

Jun 07, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here