fork download
  1. ;/* package whatever; // don't place package name! */
  2.  
  3. /* The class name doesn't have to be Main, as long as the class is not public. */
  4. class Main
  5. {
  6. public static void main (String[] args) throws java.lang.Exception
  7. {
  8. java.io.BufferedReader r = new java.io.BufferedReader (new java.io.InputStreamReader (System.in));
  9. String s;
  10. s = r.readLine();
  11. while (s = r.readLine()) {
  12. System.out.println(s);
  13. }
  14. //while (!(s=r.readLine()).startsWith("42")) System.out.println(s);
  15. }
  16. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
5
6
42
7
8
compilation info
Main.java:11: incompatible types
found   : java.lang.String
required: boolean
     while (s = r.readLine()) {
              ^
1 error
stdout
Standard output is empty