Page 6 - java programs
P. 6
import java.util.Scanner;
public class JavaProgramsExamples
{
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
int num;
System.out.println("Enter 10: ");
num = scan.nextInt();
if(num == 10)
{
System.out.println("Good");
}
else
{
System.out.println("Bad");
}
}
}
Here is the output produced by the above Java program: