byte a=5;
byte b=5;
byte c=a+b;
System.out.println(c);
whats the o/p?
Answers were Sorted based on User's Feedback
Answer / ravi
It will show compile time error
possible loss of precision
found int
reqired byte
| Is This Answer Correct ? | 27 Yes | 1 No |
Answer / 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 |
Answer / ravikiran
compilation fails
possibl;e loss of precision
because results in an int
| Is This Answer Correct ? | 10 Yes | 0 No |
Answer / janardhan
Above code , there is compile time error will coming, because
ie type mismatch error from byte to int, instead of byte we
can replace int(before a+b), it will excuite succesfully
| Is This Answer Correct ? | 4 Yes | 0 No |
Answer / kalyan
it will shows complie time error,to execute we typecast the
int to byte
| Is This Answer Correct ? | 5 Yes | 1 No |
Answer / dinesh kumar
compilation fails
possibl;e loss of precision, because
ie type mismatch error from byte to int, instead of byte we
can replace int(before a+b), it will excuite succesfully
| Is This Answer Correct ? | 1 Yes | 0 No |
What are the four integer types supported by java?
Does chrome use java?
what is mutability?which one is mutable String or StringBuffer?and why?give examples of each which shows the mutability of each String or StringBuffer
What is reflexive association?
What are the Class Libraries ?
Hi all, I am dng a mini project on FileSplitter application which splits the GBs of logfile into Smaller chunks(mbs) depending on the split size." How to handle GBs file? I am getting OutOfMemoryException, when I input such GB sized file. Thx
When throw keyword is used?
How many tetrahedral voids are there in bcc?
What is "Java Native Interface" and how to use it?
Can list be final in java?
What is a class component?
when you will synchronize a piece of your code? : Java thread