In Java, we use relational operators (==, !=, >, <, >=, <=) to help us compare numbers, which are represented by variables of the 8 primitive data types. Take note that we cannot compare a string with a number; we can only compare (use the relational operators) variables declared in the primitive data types.
The common error that students always make when writing relational operators is to mixed up the double equal sign (==) which is to check if 2 values are the same, with the single equal sign (=) which is to assign a value to a variable.
Sunday, May 6, 2007
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment