/* Name of the class has to be “Main” only if the class is public. */
class codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner in=new Scanner (System.in);
System.out.println(“Enter the ocde”);
int n=in.nextInt();
if(n==0)
System.out.println(“HI”);
else
System.out.println(“HELLO”);
}
}
You don’t need to throw an exception however if you want to just change the “throws java.lang.Exception” to “throws IOException”
Just do like
//just import the package you need in your case you just need the scanner
package
import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
Scanner in=new Scanner(System.in);
System.out.println("Enter the ocde");
int n=in.nextInt();
if(n==0)
System.out.println("HI");
else
System.out.println("HELLO");
}
}