aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes operators Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "operators" Watch "operators" New topic
Author

operators

Shubh Bhat
Ranch Hand

Joined: Sep 08, 2002
Posts: 32
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?


~-<br />Doing my best this time and everytime.<br />-- Me
Shubh Bhat
Ranch Hand

Joined: Sep 08, 2002
Posts: 32
got the answer!
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
But do you have the correct answer?


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: operators