solve this is my problem byte a=40,byte b=50 both add value is 90 this is with in range of byte... byte range is -128to 127....
why this pgm gives error like type mismatch....
package javapgms;
public class byte1 {
public static void main(String args[])
{
byte a=40,b=50;
byte c=a+b;
System.out.println(c);
}
}
note : dont use int k...
a,b,c are in byte range... mind it..
Answer Posted / siva
c=(byte)(a+b);
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Explain polymorphism citing an example.
Why is the type for real numbers called double?
Why is a string immutable?
What is entry in java?
Draw a UML class diagram for the code fragment given below: public class StringApplet extends Applet { private Label sampleString; private Button showTheString; private ButtonHandler bHandler; private FlowLayout layout; public StringApplet() { sampleString = new Label(" "); showTheString = new Button (" Show the String"); bHandler = new ButtonHandler(); layout = new FlowLayout(); showTheString.addActionListener(bHandler); setLayout(layout); add(sampleString); add(showTheString); } class ButtonHandler implements ActionListener { public void actionPerformed(ActionEvent e) { samplestring.setText("Good Morning"); } } } Note: The methods need not be indicated on the diagram.
What is the basic concepts of OOPS?
Can java cast null?
What is the importance of finally block in exception handling?
Is char * a string?
What is the difference between final, finally and finalize()?
Can you override private or static method in java?
Is binary a low level language?
What are different types of constants?
What is the final blank variable?
what is the major difference between linkedlist and arraylist in java?