Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8172015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:38:49+00:00 2026-06-06T21:38:49+00:00

I just discovered this operator and I was wondering if it is safe to

  • 0

I just discovered this operator and I was wondering if it is safe to use or not.

I mean, in Java our teachers always told us to avoid instanceof() because it breaks polymorphism and often shows poor coding.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T21:38:52+00:00Added an answer on June 6, 2026 at 9:38 pm

    It’s ‘safe’. At least it’s safer to use this check, rather than just cast and assume the type! You may prefer to use the as operator, which performs the cast to the required type if appropriate, or returns null otherwise. Just remember to check for null.

    But often an explicit type check is an indication that something is not quite right with your model. Sometimes it’s unavoidable, but if you’re doing this a lot, I would take a step back and reconsider your model.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We just discovered that every time we restart JBoss, all of our Java Web
I just discovered this, I use MySQL as my database. When i do something
I just discovered this component and started working with it. I understand that the
Possible Duplicate: Python or Ruby Interpreter on iOS I just discovered this apps pypad
I just discovered a bug where the code looked something like this: char *foo
I am working with zend just recently. I discovered this ViewScript decorator for form
[edit]: I'm terribly sorry for my timing on asking this question. I've just discovered
Just discovered an issue with the sorting plugin used on our cart, was working
I just discovered that truncate {table} statements are not caught by most database triggers.
I am not familiar at all with connection pooling library. I've just discovered it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.