Solved

Determining Object Type

Posted on 2003-11-15
2
237 Views
Last Modified: 2010-03-31
If I have an Object, but want to determine what subclass of Object it is, is there anyway to do that? In other words, how do I determine object type?
0
Comment
Question by:handle0001
  • 2
2 Comments
 
LVL 92

Accepted Solution

by:
objects earned 75 total points
ID: 9756699
You can get the class using:

Class clazz = o.getClass();

You can test if it is instance of a class/interface using:

if (o instanceof Serializable)
0
 
LVL 92

Expert Comment

by:objects
ID: 9756932
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Maven Project: Hibernate Dependencies Conflict 10 49
tomcat administrtor 12 68
Eclipse with various Java releases 7 47
web project error add remove 1 51
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn how to implement Singleton Design Pattern in Java.

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question