https://www.codechef.com/problems/TEST....where am I mistaking

import java.util.;
import java.lang.
;
import java.io.*;

class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc=new Scanner(System.in);
int i=0;
while( i!=42)
{
i=sc.nextInt();
System.out.println(i);
}
}
}

@mayankashw

whenever you are importing any package in Java, the syntax is import java..*
So it will be imported as java.util.* and import java.lang.*

You may sometimes encounter an NZEC error if there is no 42 in your custom input, as according to your code if it encounters an EOF, it will be still running though not having more inputs.

Thank you.

1 Like