hello i would like to know how can i use these isString,isInt,isDouble functions.
i really dont have a clue if these functions do exist.
but i want to create a program that lets me input anything.
and it would identify if it is a string an int or a double.
i would be using a String variable.
here's my code.
import java.util.*;
class program
{
public static void main(String[]args)
{
Scanner input=new Scanner(System.in);
String a;
System.out.print("Enter anything: ");
a=input.next();
if(a.isString)
System.out.println("this is a String");
else if(a.isDouble)
System.out.println("this is a Double");
else if(a.isInt)
System.out.println("this is an Int");
else
System.out.println("no comment");
}
}
when i runned this. the error says:
cannot find symbol: variable isString
cannot find symbol: variable isDouble
cannot find symbol: variable isInt.
i need help on how to use these functions.
or any function that could let me identify a string a double and an int
Thanks in advance.