?
Solved

How to determine whether a object is vector type?

Posted on 2003-02-27
3
Medium Priority
?
231 Views
Last Modified: 2010-03-31
I would like to have a variable type(the only one I can think of is Object) that able to hold Vector and String.

   Example:

   Object a = null;
   a = new Vector();
   a = new String("");

   If a is vector then do something else do nothing;
   How to determine if a is vector or not. There is not such method a.isVector().

Please advise.
0
Comment
Question by:realman1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 92

Accepted Solution

by:
objects earned 600 total points
ID: 8039596
if (a instanceof Vector)
{
}
else if (a instanceof String)
{
}
0
 

Author Comment

by:realman1
ID: 8039723
Hello, Object. It has been quite long time I didn't visit this forum. Nice to hear from you again. :)

Thank you for your fast response and accurate answer.
:-)
0
 
LVL 92

Expert Comment

by:objects
ID: 8039735
Happy I could help :-)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
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:
Suggested Courses
Course of the Month13 days, 10 hours left to enroll

801 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