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

How do I get a substring?

529


Why stringbuilder is not thread safe in java?

574


What is arraylist class in java?

515


What is java volatile?

545


Why do we need hashset in java?

504






Is there any way to skip finally block of exception even if some exception occurs in the exception block?

600


Tell me the Importent classes in net package?

1582


Why we use set in java?

519


What is finally in Java?

579


What is meant by local variable and instance variable?

602


What is array pointers ?

607


What are static blocks in java ?

615


Explain spliterator in java8?

601


What are the benefits of immutable objects?

539


Explain hashset and its features?

583