if (yboi > yleftwerh) { out.println("NW"); System.exit(1); Does not display in the console NW. How to fix it?
Use the following PrintWriter constructor (System.out, true)
import java.io.PrintWriter; public class Main { public static void main(String [] args){ PrintWriter out = new PrintWriter (System.out, true); out.println("Hello!"); } } flush() after each call print/println (see my answer, there I obviously flush , with the second parameter true this is not necessary) - iksuyJudging by the fact that you have written out.println("NW") you use your PrintWriter . To see the content, you need to flush() buffer by calling flush() .
That is, do so:
out.println("NW"); out.flush(); System.exit(1); When using PrintWriter in small training projects, it is convenient to wrap two calls into one method:
private static PrintWriter out = new PrintWriter(System.out); //...some code... private static void println(Object o){ out.println(o); out.flush(); } and call it when needed:
println("NW"); System.exit(1); Source: https://ru.stackoverflow.com/questions/583213/
All Articles
System.out.println("NW")? - Igor Kudryashov