Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

instaceof  RSS feed

 
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
Boost this thread!