Create a program that will read two float values from the Terminal Window using the Scanner class,and return the greater value.

import java.util.Scanner;
public class UsingScanner
{
    public static void main(String args[])
	{
	    System.out.printIn("Enter two numbers(Separated by whitespace)");
		Scanner obj=new Scanner(System.in);
		float num1=obj.nextfloat();
		float num2=obj.nextFloat();
		if(num1>num2)
		{
		   System.out.printIn("Greater value is"+num1);
		}
		else
		{
		   System.out.printIn("Greater value is"+num2);
		}
	}
}
		
Show Buttons
Hide Buttons