Basically, the program is supposed to ask for the user's name and print it out in reverse and in all lowercase letters.
However, when I run it, Eclipse makes the debugger open... I get "Source not found."
Debugger shows this:
Don't know how there could be an error as line 1762...NameReversal [Java Application]
NameReversal at localhost:52896
Thread [main] (Suspended (exception StringIndexOutOfBoundsException))
String.substring(int, int) line: 1762
NameReversal.main(String[]) line: 13
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/bin/java
Here's the code:
import java.io.*; import java.util.*; public class NameReversal { public static void main(String args[]) { Scanner kbreader = new Scanner(System.in); System.out.print("Please enter your name. "); String name = kbreader.nextLine(); int howLong = name.length(); for(int g=howLong;g>=0;g--) { String reversed = name.substring(g-1,g); System.out.print(reversed.toLowerCase()); } } }
Reeaaalllly confused here.