Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

operators

 
Shubh Bhat
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
q1. can anyone give me a complete and good source on operators?
q2.

public class TestByte
{
public static void main(String[] arg) {
int i=1, j=2;
byte b = 127;
short k = 1;
short s1 = (short)i + (short)j; //1
short s2 = (short)(i + j);
i = (short)j + b>>2;
i = (short)i + (short)i; //2

}
}
why should 1 complain and not 2?
 
Shubh Bhat
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
got the answer!
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But do you have the correct answer?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic