Difference between revisions of "Pascal for Java users"
From Lazarus wiki
Jump to navigationJump to searchLine 84: | Line 84: | ||
| | | | ||
|- | |- | ||
− | | class | + | | class TheClass { } |
− | | [[Class]] | + | | TheClass = [[Class]] [[End]]; |
| | | | ||
|- | |- | ||
Line 101: | Line 101: | ||
|- | |- | ||
| extends | | extends | ||
− | | | + | | SubClass = [[Class]](BaseClass) |
| class SubClass extends BaseClass --> SubClass(BaseClass) | | class SubClass extends BaseClass --> SubClass(BaseClass) | ||
|- | |- | ||
| final | | final | ||
− | | | + | | [[Const]] |
− | | | + | | for constants, not uninheritables |
|- | |- | ||
| for ++ | | for ++ | ||
Line 125: | Line 125: | ||
|- | |- | ||
| implements | | implements | ||
− | | | + | | SomeClass = [[Class]](SomeInterface) |
− | | | + | | |
|- | |- | ||
| import | | import | ||
Line 137: | Line 137: | ||
|- | |- | ||
| interface | | interface | ||
− | | | + | | TheInterface = [[Interface]] |
| | | | ||
|- | |- | ||
Line 144: | Line 144: | ||
| | | | ||
|- | |- | ||
− | | new | + | | new primitive_type[#]; |
− | | | + | | SetLength(ArrayVar, #); |
− | | | + | | |
+ | |- | ||
+ | | new Class(); | ||
+ | | InstanceVar := TheClass.Create; | ||
+ | | | ||
|- | |- | ||
| package | | package |
Revision as of 01:55, 30 March 2009
Java | Pascal | |
---|---|---|
{ | 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 end |
// | // | End of line comment (only one line comment) |
null | Nil | |
abstract | Abstract | |
class TheClass { } | TheClass = Class End; | |
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 | ||
new primitive_type[#]; | SetLength(ArrayVar, #); | |
new Class(); | InstanceVar := TheClass.Create; | |
package | Unit | |
private | Private | |
protected | Protected | |
public | Public | |
return | Result | |
static | ||
super | Inherited | |
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 | |
long | Comp | 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 |