public class Main { public static void main(String args[]) { int x=10; if(x>=20 && x<=30) { System.out.println("Valid Number"); } else { System.out.println("Invalid Number"); } } }
Invalid Number
public class Main { public static void main(String args[]) { int x; x=Integer.parseInt(args[0]); if(x>=20 && x<=30) { System.out.println("Valid Number"); } else { System.out.println("Invalid Number"); } } }
Invalid Number
import java.util.*; public class Main { public static void main(String args[]) { int x; Scanner s=new Scanner(System.in); System.out.println("Enter x Value"); x=s.nextInt(); if(x>=20 && x<=30) { System.out.println("Valid Number"); } else { System.out.println("Invalid Number"); } } }
Enter x value
10
Invalid Number