//For each string of array args print the string, its length, its first symbol, and its last symbol.
public class A8b {
public static void main(String[] args) {
int i = 0;
for(i = 0; i < args.length; i++) {
System.out.println(args[i]); //print the string
System.out.println(args[i].length()); //length of string
System.out.println(args[i].substring(0,1)); //its first symbol
System.out.println(args[i].length()-1); //its last symbol <<----------
}
}
}
So my question is how to print the last symbol of string? I'm trying to do it this way
System.out.println(args[i].length()-1);//its last symbol
but it gives me a wrong answer. Does anybody can help me?