byte a=5;
byte b=5;
byte c=a+b;
System.out.println(c);
whats the o/p?

Answer Posted / amulkumar

CE:Type mismatch: cannot convert from int to byte
at byte c=a+b;

to avoid this typecast: byte c=(byte)a+b;
or
int c=a+b;

Is This Answer Correct ?    18 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is integer passed by reference in java?

558


What is difference between printf and scanf?

513


how are methods defined?

547


Explain different types of wrapper classes in java?

591


What is the difference between a break statement and a continue statement?

589






Explain parallel processing in java8?

628


Compare java and python.

573


What is the constructor?

572


What is scope of a variable?

596


What does 0 mean in boolean?

533


what is static import in java? Explain

546


Difference between arraylist and hashset in java?

533


Considering notepad/ie or any other thing as process, what will happen if you start notepad or ie 3 times? Where 3 processes are started or 3 threads are started?

648


What is function declaration?

519


What is the difference between java applets and applications?

560