Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

instaceof

 
Sefa Urgenc
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,
I was wondering why the instanceof of operator is not compiling in the following code.

Thanx in Advance
 
Richard Jensen
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sefa Urgenc:
I was wondering why the instanceof of operator is not compiling in the following code.

Thanx in Advance

instanceof works on an object, not a class. So first you would need a subclass of A (so you can instantiate an object--A is abstract) and then you would need to create the object.

And then your main would look like:
 
Sefa Urgenc
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, I totally forgot about that, my bad.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic