This may be the dumbest question ever asked in a stack overflow, but it bothers me a lot ...
public class shorte
{
public static void main(String []args)
{
short e = 56;
System.out.println(e);
start(56);
}
static void start(short e)
{
System.out.println(e);
}
}
when creating a normal short variable from int literal, the function did not request any explicit cast, but why passing an int literal to a short variable (passing parameters) requires explicit casting ...... ??
and again
i now it is not recommended to ask two unrelated questions in one message, but this is too trivial to ask in another message ..
** scope of the "for" counter variable **
public class forloop
{
public static void main(String []args)
{
int a =12;
for(int a =12;a<14;++a)
{
System.out.println(a);
}
}
}
so I tried it with regular blocks
a=12
{
a=13; even this doesn't compile
}
Does this mean that the blocks do not have their own area ...