Learning Java as a C++ Programmer

Primitive Data Types

  • char is 16-bit. byte is 8-bit. boolean corresponds to bool in C++.
  • All Java primitive types are signed.Why?


  • Java is more strongly typed than C++. No way to convert between boolean and integer types.


  • Java has two new operators, >>> and >>>=. Each of these performs a right shift with zero fill.
  • Java operators cannot be overloaded, in order to prevent unnecessary bugs

Struct and union

    No struct or union.


  • Arrays are objects, defined by Type [].
  • Out of index accessing causes ArrayIndexOutOfBoundsException exception.


  • Can set default value of class data members