import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
char temp;
char temp2;
System.out.println("Enter Word");
String x = in.next();
System.out.println("Your Word has " + x.length()+ " Letters" + "\n");
int[] array = new int[x.length()];
for(int i = 0; i < array.length; i++){
array[i] = x.charAt(i);
}
temp = x.charAt(0);
**x.charAt(0) = x.charAt(x.length);
x.charAt(x.length()) = temp;**
System.out.println(x);
}
}
I wanted to switch the first Letter and the last letter of a word but I get this error The Left Hand Side Of An Assignment Must Be A Variable
The error is in the X.charAt(0) = x.charAt(x.length) x.charAt(x.length()) = temp;
Sorry if it's a dumb question I'm kind of new to programming.