• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Primitive Narrowing Question

 
Ranch Hand
Posts: 584
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!