Multiline Comment Problem in JAVA

Here I am trying to submit my first java solution codechef.
But I am facing problem due to multiline commenting error problem…Can you help?
here is my code:

 /*
    RAMESH CHANDRA
    NATIONAL INSTITUTE OF TECHNOLOGY KARNATAKA SURATHKAL
    Note: FIRST PROGRAM WRITTEN IN JAVA SUBMITTED TO CODECHEF....21 FEB 2016
 */

  import java.util.Scanner;
  public class Main{
       public static void main(String[] args) {
	    int x;
	    Boolean flag=true;
	    Scanner inp=new Scanner(System.in);
	    while(flag){
		  x=inp.nextInt();
		     if(x!=42)System.out.printf("%d\n",x);
		     else flag =false;
	     }
        }
  }

Happy coding

In codechef classes shouldn’t be declared public.

1 Like

/* this will run*/

import java.util.Scanner;

  public class Flag{
    public static void main(String[] args){
	  int x;
	  Boolean flag=true;
	  Scanner inp=new Scanner(System.in);
	while(flag){
	x=inp.nextInt();
		if(x!=42){	
			System.out.println(x);
			}
		else
		flag=false;
		}
			}
	}
1 Like
//