• 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
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Primitive Narrowing Question

 
Ranch Hand
Posts: 584
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,

Could you please help me with the following question :

What is the difference between the rules for method-call conversion and the rules for assignment conversion?

A. There is no difference; the rules are the same.

B. Method-call conversion supports narrowing, assignment conversion does not.

C. Assignment conversion supports narrowing, method-call conversion does not.

D. Method-call conversion supports narrowing if the method declares that it throws ClassCastException.

According to the author the correct choice is A, but I chose C.

I think the rules are different when aplied to method-call conversion and simple assignment conversion.

Here is my explanation :



As per my preceeding code, it's proved that conversion rules(I mean, narrowing) are different when aplied to method-call and simple assignment sentence.

Any comments would be highly appreciated.

Thanks.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic