instanceof


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: instanceof

  1. #1
    Join Date
    Sep 2005
    Posts
    11

    instanceof

    Does anyone know the answer to this?
    Suppose r contains a reference to a new Rectangle(5, 10, 20, 30). Which of these conditions return true?
    a) r instanceof Rectangle
    b) r instanceof Shape
    c) r instanceof Point
    d) r instanceof Object
    e) r instanceof ActionListener
    f) r instanceof Serializable

  2. #2
    Join Date
    Aug 2005
    Posts
    43
    you need to specify how your class hierarchy is

  3. #3
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    1,560
    a) r instanceof Rectangle - true
    b) r instanceof Shape - true
    c) r instanceof Point - false
    d) r instanceof Object - true
    e) r instanceof ActionListener - false
    f) r instanceof Serializable - true
    eschew obfuscation

Similar Threads

  1. GUI Refresh problem?
    By Lim Wing Hoe in forum Java
    Replies: 7
    Last Post: 11-17-2000, 02:12 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center