0

My compiler i.e command prompt closes automatically as soon as it opens. What can work for me here?

I use a 32 bit dell laptop currently running windows 7.

15th Nov 2016, 5:06 PM
Mohit Sharma
Mohit Sharma - avatar
6 Antworten
+ 1
I believe your program is executing properly. Just put a user input await at the end, so that till you enter something, program won't complete execution.
15th Nov 2016, 5:14 PM
Nagendra Prajwal
Nagendra Prajwal - avatar
+ 1
Scanner reader = new Scanner(System.in); int n = reader.nextInt(); use this. it's just user input. Your program has to get delayed till you read the results. just enter some number at the end for the program to close.
15th Nov 2016, 5:24 PM
Nagendra Prajwal
Nagendra Prajwal - avatar
+ 1
that's because the program starts then shows output and then when it finishes it closes. to stop that you can add input this way program will keep open and close when it finds the input
15th Nov 2016, 7:17 PM
Sandeep Chatterjee
0
What is a user input await?
15th Nov 2016, 5:16 PM
Mohit Sharma
Mohit Sharma - avatar
0
Thank you Nagendra
15th Nov 2016, 6:32 PM
Mohit Sharma
Mohit Sharma - avatar
0
nothing makes a programmer happier than solving problems. :)
15th Nov 2016, 6:36 PM
Nagendra Prajwal
Nagendra Prajwal - avatar