Previous Topic Next topic Print topic


Operators - in COBOL and Java

Operators in Managed COBOL

*> Comparison
= < > <= >= <>
 
*> Arithmetic
+ - * /
function mod
*>no direct COBOL equivalent to integer division
**
 
*> Assignment
move, set, compute
 
*> Bitwise
b-and, b-or, b-xor, b-not, b-left, b-right
 
*> Logical
and, or, not 

Operators in Java

// Comparison
==  <  >  <=  >=  !=
 
// Arithmetic
+  -  *  /
%  (mod)
/  (integer division if both operands are ints)
 
// Assignment
=  +=  -=  *=  /=   %=  &=  |=  ^=  <<=  >>=  ++  --
 
// Bitwise
&   |   ^   ~   <<   >>
 
// Logical
&&   ||   &   |   ^   !
 
// String Concatenation
+

Portions of these examples were produced by Dr. Frank McCown, Harding University Computer Science Dept, and are licensed under a Creative Commons License.

Previous Topic Next topic Print topic