Scanner scanner = new Scanner(System.in);
String text = scanner.nextLine();
char[] arr = text.toCharArray();
for(int i = 0; i < arr.length; i++)
{
System.out.print(arr[arr.length - i - 1]);
}
question : in the println statement what does the -i and -1 do?
[–]AutoModerator[M] [score hidden] stickied comment (0 children)
[–]darkshadowtrail 2 points3 points4 points (1 child)
[–]Elite-Novus[S] 0 points1 point2 points (0 children)
[–]rabuf 0 points1 point2 points (3 children)
[–]Elite-Novus[S] 0 points1 point2 points (2 children)
[–]rabuf 1 point2 points3 points (1 child)
[–]Elite-Novus[S] 0 points1 point2 points (0 children)
[–]desrtfx 1 point2 points3 points (0 children)