Adri Jamis wrote: please point me out where exactly, byte is implicitly cast to int my example(this code is taken from scjp ref. material)
byte is never implicitly casted to int...It is int which is implicitly casted to byte. See by default the all whole numbers like 23,55,1000,2055 etc all are of int data type by default (i.e. integer literals are of type int by default). So when you are writing
50 is of type int but since it is stored in byte it is implicitly casted to byte and now the question arises why implicit cast happened??? It happened because the value which i was storing (i.e. 50 in above example) was well within the range of byte which is -128 to 127.So the summary is whenever you are storing a number between -128 to 127(which are int by default) in a byte variable there will be an implicit cast. So when you are storing an number greater than 127 in byte you need to do an explicit cast. Example
I hope this answers your question number 1.