Showing posts with label example java. Show all posts
Showing posts with label example java. Show all posts

Saturday, 3 September 2011

Conditional Operators in java


import java.util.Scanner;
class abc
{
public static void main(String args[])
{
Scanner input=new Scanner(System.in);
double a,b;
System.out.print("Enter two numbers\nEnter 1st number:");
a=input.nextDouble();
System.out.print("Enter 2nd number:");
b=input.nextDouble();
System.out.println(a<b?"2nd number is greater....":"1st number is greater....");
}
}