Monday, 2 September 2013

How to implement If Statement in java tutorial

If Statement in java


import java.util.*;// we import java util package for input output

//now we make our class

class Tree
 public static void main(String args[])  //this is our main function
  int a=30,b;
  Scanner scn=new Scanner(;  //this is a class define in import java util
  System.out.println("Enter any numb");
  b=scn.nextInt(); //this is for input

  System.out.println("Wow you guess the numb");
  else if(b<a)
  System.out.println("Sorry your num is less then the original");

System.out.println("Sorry yor num is greater than original");


No comments:

Post a Comment