Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

It says Process Finished but there is no output

I’m new to java and I’m having a little problem with my code. There’s no error and such, it just keeps saying process finished but no output was displayed. The filename is correct as I’ve checked.

import java.nio.file.;
import java.io.
;

public class GuessingGame {
    public GuessingGame() {
        String filename = "C:\\Users\\angela\\Documents\\words.txt";
        Path path = Paths.get(filename.toString());
        
        try {
            InputStream input = Files.newInputStream(path);
            BufferedReader read = new BufferedReader(new InputStreamReader(input));
            
            String word = null;
            while((word = read.readLine()) !=null) {
                System.out.println(word);
            }
        }
        catch(IOException ex) {
            
        }
    }
    public static void main (String[] args) {
        new GuessingGame();
    }
}

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You managed to call the intended class, but you also needed to specify the specific function which you have declared in the function. Like so:
public static void main (String[] args) { GuessingGame gg = new GuessingGame; gg.GuessingGame(); }

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading