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

Give the hierarchy of inputstream and outputstream classes.

786


If a variable is declared as private, where may the variable be accessed?

758


Can an interface extend a class?

711


Can we override a variable in java?

739


How to declare an arraylist in java?

664






How does multithreading take place on a computer with a single cpu in java programming?

720


What is the latest version of java?

773


What language is pass by reference?

751


What is number data type?

740


Can we have try block without catch block?

759


when you will synchronize a piece of your code? : Java thread

728


How do you use nextline in java?

675


How do you calculate square roots?

804


What is the difference between this() and super() in java?

737


how we can use debug in myeclipse 6.0 in order solve the problems that exist in our program when there are 900 to 1000 pages in a web application

1849