I wrote a code. After many trials I was pretty sure that is ok so I verify it. It passed, task was completed. But still... the program doesnt work! I run it and after wrote 10 Strings an output is like "3", "5", sometimes its empty. I reinstall InteliiJ, but still something is wrong although solution is fine (I download correct solution from codegym to compare my code and correct code). Anybody has idea why it is like that? I paste the code it into NetBeans and it works fine. Why the same code doesnt work on InteliiJ?
solution is fine, task completed, but program doesn't work well...
Musisz się zalogować, aby dodać komentarz
10 sierpnia 2021, 13:46
Were you running the correct task? In intelliJ it runs the last task you set whenever you hit the green run button on the top. This is a convenience feature of IntelliJ as pretty much all projects you work on professionally are going to have multiple classes. When writing code and starting to test it, you will have multiple main methods and you will want to be able to set which one will run when you hit the "run" button. There is a green arrow "run" button to the left of the main method on each task, in the area that has the line numbers. Use this from now on as it specifies that you want to run that main method and not the one specified above. This may or may not be the issue. Without any screen shots of the problem this is my best guess.