Im writing a program in Eclipse IDE that reads text from a file and converts the text to a sequence of numbers. The code I've written worked, as I've seen the console output before, but suddenly the console has stopped outputting anything.
Is there a setting I can change to get this working again? Or do you notice as issue with the code that would cause no output in the console?
I'm stuck with this and just want to move past it thank you!
package poetry;
import java.util.Scanner;
import java.io.File;
import java.io.FileNotFoundException;
public class POETRY {
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
File x = new File("/Users/jordanBendon/Desktop/Cypher/poem.txt");
Scanner sc = new Scanner (x);
Scanner scnr = new Scanner(x);
while(scnr.hasNextLine()) {
String lines = scnr.nextLine();
char[] stringArray = lines.toCharArray();
String result = "";
for (int i = 0; i < lines.length(); i++) {
int ascii = lines.codePointAt(i);
if ((ascii >= 65 && ascii <= 90) || (ascii >= 97 && ascii <= 122)) {
ascii += 15;
result += Integer.toString(ascii);
} else {
result += stringArray[i];
}
}
System.out.println(result);
};
}
catch (Exception e) {
System.out.println("error");
}
}
}