www.delorie.com/gnu/docs/gcc/gcj_26.html   search  
 
Buy the book!


Guide to GNU gcj

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

10.3 Primitive types

Java provides 8 primitives types which represent integers, floats, characters and booleans (and also the void type). C++ has its own very similar concrete types. Such types in C++ however are not always implemented in the same way (an int might be 16, 32 or 64 bits for example) so CNI provides a special C++ type for each primitive Java type:

Java type C/C++ typename Description
char jchar 16 bit Unicode character
boolean jboolean logical (true or false) values
byte jbyte 8-bit signed integer
short jshort 16 bit signed integer
int jint 32 bit signed integer
long jlong 64 bit signed integer
float jfloat 32 bit IEEE floating point number
double jdouble 64 bit IEEE floating point number
void void no value

When refering to a Java type You should always use these C++ typenames (e.g.: jint) to avoid disappointment.


  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003