Delphi <=> Java: Datatypes

So you know Delphi or Java and want to learn the other language? A very important thing to know is what datatypes you are using, as these differ in each language.

As you may know, Java does not have any unsigned datatypes, Delphi however has both signed and unsigned datatypes. Because of this the unsigned types are not listed in the table below, but in order for the integer types these are Byte/UInt8, Word/UInt16, Cardinal/LongWord/UInt32, UInt64. Delphi also has ansi strings/chars, these can be stores in string and Char but those can also hold unicode versions, the actual ansi types are AnsiString and AnsiChar. And of course Delphi also comes with a Pointer type as well as it has the ability to create types that hold pointers to specific types.

JavaDelphiTypeData
byteShortInt, Int88-bit signed integer-128 to 127
shortSmallInt, Int1616-bit signed integer-32768 to 32767
intInteger, LongInt, Int3232-bit signed integer-2147483648 to 2147483647
longInt6464-bit signed integer-9223372036854775808 to 9223372036854775807
floatSingle32-bit floating point value
doubleDouble64-bit floating point value
booleanBooleanboolean valuetrue or false
charChar (stores both ansi and unicode chars), WideChar, UnicodeChar16-bit unicode charactera single unicode character
Stringstring (stores both ansi and unicode strings), Widestring, UnicodeStringunicode stringa string consisting out of unicode characters
ObjectTObjectan objectobject pointer

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.