Morning. Working on a project. It builds and compiles but it doesnt display data in the console ? I have an input file that i am using but cant understand why I dont see anything in the console.
Below is the code. I have no errors when compiling.
What am i missing?
This is the input text for the input.txt file
This is a test, this is only a test!
This test is a test of your Java programming skills!
xyz
ABCDEFGHIJKLMONPQRSTUVWXYZ1234567890-=_+ !
end data
public class Project1 { /** * @param args the command line arguments * @throws java.io.FileNotFoundException */ public static void main(String[] args) throws FileNotFoundException, IOException { FileReader inputStream = new FileReader("input.txt"); class StringConversion { public String lowerCaseString = ""; public String lowerCaseString(String trimmed) { lowerCaseString = trimmed.toLowerCase(); return this.lowerCaseString; } } } public static class ThreeMethods { //white space public static String trimmed(String s) { if (s == null) { return ""; } return s.trim(); } //return a trimmed string of size len public static String trimmed(String s, int len) { String retVal = ThreeMethods.trimmed(s); if (len > retVal.length()) { len = retVal.length(); } return retVal.substring(0,len); } //convert all double spaces to a single space public static String squeeze(String s) { return s.replace(" ", " "); } } //This method will read strings from the input file //and perform manipulations on each string. The results of the //manipulations are displayed in the text area private void displayStrings() throws Exception { FileReader inputStream = new FileReader("input.txt"); BufferedReader reader= new BufferedReader(inputStream); // //Get the next line in the file // String str = reader.readLine(); //Trim and Squeeze System.out.print("Trim & Squeeze: " + ThreeMethods.squeeze(ThreeMethods.trimmed(str)) + "\n"); //Trim, Squeeze, and Shorten to 10 characters System.out.print("Trim, Squeeze, Shorten to 10: " + ThreeMethods.trimmed(ThreeMethods.squeeze(ThreeMethods.trimmed(str)),10) + "\n"); //Trim, Squeeze, lower-case and shorten to 20 characters System.out.print("Trim, Squeeze, Shorten to 20, lower-case: " + ThreeMethods.trimmed(ThreeMethods.trimmed(ThreeMethods.squeeze(ThreeMethods.trimmed(str)),20)) + "\n"); System.out.print("\n"); } } }