aspose file tools*
The moose likes Java in General and the fly likes data type in java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "data type in java" Watch "data type in java" New topic
Author

data type in java

kamalkant rajput
Greenhorn

Joined: Nov 26, 2007
Posts: 22
hi,
I wanted to know is there any API in java by which I can know the type of data is coming e.g. whether it is Integer,String ,Boolean etc.
thanks in advance
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39578
    
  27
What is "the data that is coming" - where is it coming from? In what format? Apparently not from inside of a JVM?


Ping & DNS - updated with new look and Ping home screen widget
kamalkant rajput
Greenhorn

Joined: Nov 26, 2007
Posts: 22
thanks for reply,
My problem is like that suppose i am having a class from which i am getting an object but i don't what is data type of member variables.
I wanted to know the data type of member variables.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39578
    
  27
You mean the method returns a java.lang.Object? You can get at the class name through obj.getClass().getName() - that'll return the fully qualified class name.

You can also check for particular classes as follows:
Bill Shirley
Ranch Hand

Joined: Nov 08, 2007
Posts: 457
A major point of Object-Oriented programming is that you DON'T know the types of the instance variables.

the Java introspection APIs could help you out, but you should probably be solving your problem in some other way,

if you want more detailed answers, provide an example of the problem you are having,


Bill Shirley - bshirley - frazerbilt.com
if (Posts < 30) you.read( JavaRanchFAQ);
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: data type in java
 
Similar Threads
Object data type
Pass XML datatype instead of Java data type
help with data types and casting
Binary Data type in wsdl
Find the data type of a variable