This week's book giveaway is in the Agile forum.
We're giving away four copies of Head First Agile and have Andrew Stellman & Jennifer Greene on-line!
See this thread for details.
Win a copy of Head First Agile this week in the Agile 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!