wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes short vs short array inconsistency? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "short vs short array inconsistency?" Watch "short vs short array inconsistency?" New topic
Author

short vs short array inconsistency?

Arnab Sunny Rakshit
Greenhorn

Joined: Jun 07, 2013
Posts: 19

why does the short array assignment work but the short assignment not work?



However if I do this then compiler ain't happy !



Does this mean that an auto cast (from wider to leaner) is happening when array elements are initialized? But no such downcast happens during plain primitive assignment?
Arnab Sunny Rakshit
Greenhorn

Joined: Jun 07, 2013
Posts: 19

Please disregard. I misinterpreted the above.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: short vs short array inconsistency?
 
Similar Threads
Question on primitive
Casting
Casting question
my notes on JLS for any1 who needs them !!
how to assign some numeric values like 1 ... to a short variable ?