Coding:
/* Read input from STDIN. Print your output to STDOUT*/
import java.io.*;
import java.util.*;
public class MyCode {
public static void main(String args[] ) throws Exception {
//Write code here
Scanner input=new Scanner(System.in);
if(input.hasNextInt())
System.out.println("This input is of type Integer.");
else if(input.hasNextFloat())
System.out.println("This input is of type Float.");
else if(input.hasNextLine())
System.out.println("This input is of type String.");
else
System.out.println("This is something else. ");
}
}
Output:
-2580
This input is of type Integer.
No comments:
Post a Comment