• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

OCPJP7 mock exam questions' solutions

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Expression (s instanceof java.util.Date) will return false if 's' was declared as a variable of class java.lang.String.
A) true
B) false


I answered this question but it was incorrect.My answer was A.Because I thought that expression would give us false.And I agreed that expression's evaluation, so I chose true.How my answer would be incorrect one, I didn't understand that.Please guys clarify this one.
 
Sheriff
Posts: 5508
326
IntelliJ IDE Python Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please quote the source of this question. Where did you get it from?
 
Javid Azimli
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Cooke wrote:Please quote the source of this question. Where did you get it from?



I got it from ethuware test bank.
 
Marshal
Posts: 8623
623
Mac OS X VI Editor BSD Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Eclipse Console wrote:Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Incompatible conditional operand types String and Date

So, the answer is B) false - it won't return false.
 
Javid Azimli
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Liutauras Vilda wrote:

Eclipse Console wrote:Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Incompatible conditional operand types String and Date

So, the answer is B) false - it won't return false.



I've understood.lot of thanks man.Apreciate.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic