for e.g if i enter 100, i want to see in console, "integer value" if i enter text, it should display "string value" if i enter date, it should display "date".
Please let me know Thanking You. Regards, Edward
Garrett Rowe
Ranch Hand
Joined: Jan 17, 2006
Posts: 1295
posted
0
When you enter text into a text-box, that text is represented as a String, always. You could write code that examines that String and decides whether it makes sense to parse that String into a Date, or an int, or some other type.
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
Ashwin Sharma
Greenhorn
Joined: Nov 03, 2006
Posts: 28
posted
0
hi.... This may help try{ Integer.parseInt("2 "); System.out.println("Integer"); }catch(NumberFormatException e) { System.out.println("String"); }
Rahul Bhattacharjee
Ranch Hand
Joined: Nov 29, 2005
Posts: 2300
posted
0
Originally posted by Edward Durai:
String str = "Test INPUT"; int it = 44;
What do you give me to solve this question ?
If you give me a java object reference and ask me whether its pointing to String object or a int primitive , then I would say its String as reference to String object cannot contain int primitive.