File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

instaceof

 
Sefa Urgenc
Ranch Hand
Posts: 34
  • 0
  • 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
  • 0
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, I totally forgot about that, my bad.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic