Difference between revisions of "Pascal for Java users"
From Lazarus wiki
Jump to navigationJump to search (Made a mistake in types section) |
|||
Line 273: | Line 273: | ||
| 8-bit | | 8-bit | ||
| -128 .. 127 | | -128 .. 127 | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
| | | | ||
|- | |- | ||
Line 285: | Line 279: | ||
| 16-bit | | 16-bit | ||
| -32768 .. 32767 | | -32768 .. 32767 | ||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
| int | | int | ||
Line 302: | Line 291: | ||
| -2147483648..2147483647 | | -2147483648..2147483647 | ||
| | | | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
| long | | long | ||
Line 319: | Line 296: | ||
| 64-bit | | 64-bit | ||
| -9 223 372 036 854 775 808 .. 9 223 372 036 854 775 807 | | -9 223 372 036 854 775 808 .. 9 223 372 036 854 775 807 | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
| | | | ||
|- | |- | ||
Line 348: | Line 319: | ||
| [[WideChar]] | | [[WideChar]] | ||
| 16-bit | | 16-bit | ||
+ | | | ||
+ | | | ||
+ | |- | ||
+ | | String | ||
+ | | [[String]] | ||
| | | | ||
| | | |
Revision as of 02:17, 30 March 2009
Java | Pascal | Additional comments |
---|---|---|
{ | Begin | |
} | End | |
= | := | Becomes |
== | = | Equal |
/ | / | Division (or sometimes div) |
% | Mod | Modulo operation |
! | Not | |
!= | <> | Not equal |
&& | And | |
|| | Or | |
^ | Xor | |
>> | Shr | bit shift right |
<< | Shl | bit shift left |
++ | Inc | |
-- | Dec | |
/* | { | Comment start |
/* | (* | Comment start |
*/ | } | Comment end |
*/ | *) | Comment end |
// | // | End of line comment (only one line comment) |
null | Nil | |
abstract | Abstract | |
break | Break | |
class TheClass { } | TheClass = Class End; | |
class TheClass<T> { } | Generic TheClass = Class<T> End; | Generics are classes only as of 2.2.2, likely to support more in the future |
continue | Continue | |
do while | Repeat Until Not | |
do while ! | Repeat Until | |
extends | SubClass = Class(BaseClass) | class SubClass extends BaseClass --> SubClass(BaseClass) |
final | Const | for constants, not uninheritables |
for ++ | For To Do | |
for -- | For Downto Do | |
if() | If Then | |
if() else | If Then Else | |
implements | SomeClass = Class(SomeInterface) | |
import | Uses | |
instanceof | Is | |
interface | TheInterface = Interface | |
native | StdCall | |
native | CDecl | |
new primitive_type[#]; | SetLength(ArrayVar, #); | |
new Class(); | InstanceVar := TheClass.Create; | |
package | Unit | |
private | Private | |
protected | Protected | |
public | Public | |
return | FunctionName | |
return | Result | |
static | Static | |
static | Class Function | |
static | Class Procedure | |
super | Inherited | Parent constructor call |
switch case break | Case Of End | |
switch case break default | Case Of Else End | |
synchronized | ||
this | Self | |
throw | Raise | |
throws | ||
transient | ||
try { } catch | Try except | |
try { } catch finally | Try Finally | |
void | Procedure | |
volatile | ||
while | While Do |
Java type | Pascal type | Size (bits) | Range | |
---|---|---|---|---|
byte | Shortint | 8-bit | -128 .. 127 | |
short | SmallInt | 16-bit | -32768 .. 32767 | |
int | LongInt | 32-bit | -2147483648..2147483647 | |
int | Integer | 32-bit | -2147483648..2147483647 | |
long | Int64 | 64-bit | -9 223 372 036 854 775 808 .. 9 223 372 036 854 775 807 | |
float | Single | 32-bit | 1.5E-45 .. 3.4E+38 | |
double | Double | 64-bit | 5.0E-324 .. 1.7E+308 | |
boolean | Boolean | False True | ||
char | WideChar | 16-bit | ||
String | String |