Differences from C/C++
Home ] Up ] The Java Operators ] [ Differences from C/C++ ]

 

 

Here are some ways in which Java operators differ from those of C and C++:

Java C & C++ Comments
No comma operator Support comma operator Java's for statement supports a useful syntax, like in C/C++
No reference or dereference operators (*, -> and &) Support reference and dereference operators. Java has no pointers.
No sizeof operator Support sizeof operator Java doesn't need it for portability
Doesn't consider [] and . to be operators Consider [] and . to be operators  
The + operator applied to Strings concatenates them.   Conversion is performed automatically for primitive types, and by calling the toString() method for non-primitive types.
Supports instanceof operator C++ has typeid operator Tests whether an object is an instance of a class or whether it implements an interface.
Supports >>> operator   Right-shifts with zero extension.
Supports variety of &, | and ^ operators, depending on operand type.   Operators perform bitwise operations on integral values, but boolean operations on boolean values.
 

This page was last modified on 02 October, 2007