Difference between revisions of "Pascal for Java users/de"

From Free Pascal wiki
Jump to navigationJump to search
Line 8: Line 8:
 
! Java !! [[Pascal/de|Pascal]] !! Kommentare
 
! Java !! [[Pascal/de|Pascal]] !! Kommentare
 
|-
 
|-
|   {  
+
|   {
|   Begin  
+
|   Begin
|  
+
|   Anfang eines Anweisungsblocks
 
|-
 
|-
|   }  
+
|   }
 
|   End
 
|   End
|  
+
|   Ende / Abschluss eines Anweisungsblocks
 
|-
 
|-
|   =  
+
|   =
 
|   :=
 
|   :=
|   Zuweisung  
+
|   Zuweisung
 
|-
 
|-
|   ==  
+
|   ==
 
|   =
 
|   =
 
|   Gleich
 
|   Gleich
 
|-
 
|-
|   /  
+
|   /
|   /  
+
|   /
|   Division  
+
|   Division
 
|-
 
|-
|   %  
+
|   %
 
|   Mod
 
|   Mod
 
|   Modulo (Division ohne Rest)
 
|   Modulo (Division ohne Rest)
 
|-
 
|-
|   !  
+
|   !
 
|   Not
 
|   Not
 
|   Nichten (Den Wahrheitswert in sein Gegenteil ändern)
 
|   Nichten (Den Wahrheitswert in sein Gegenteil ändern)
 
|-
 
|-
|   !=  
+
|   !=
 
| &nbsp; <>
 
| &nbsp; <>
| &nbsp; ungleich &nbsp;
+
| &nbsp; ungleich
 
|-
 
|-
| &nbsp; && &nbsp;
+
| &nbsp; &&
 
| &nbsp; And
 
| &nbsp; And
 
| &nbsp; logisches UND
 
| &nbsp; logisches UND
 
|-
 
|-
| &nbsp; <nowiki> || </nowiki> &nbsp;
+
| &nbsp; <nowiki> || </nowiki>
 
| &nbsp; Or
 
| &nbsp; Or
 
| &nbsp; logisches ODER
 
| &nbsp; logisches ODER
 
|-
 
|-
| &nbsp; ^ &nbsp;
+
| &nbsp; ^
 
| &nbsp; Xor
 
| &nbsp; Xor
 
| &nbsp; exclusives ODER
 
| &nbsp; exclusives ODER
 
|-
 
|-
| &nbsp; >> &nbsp;
+
| &nbsp; >>
 
| &nbsp; Shr
 
| &nbsp; Shr
| &nbsp; bitweises '''sh'''ift '''r'''ight &nbsp;
+
| &nbsp; bitweises '''sh'''ift '''r'''ight
 
|-
 
|-
| &nbsp; << &nbsp;
+
| &nbsp; <<
 
| &nbsp; Shl
 
| &nbsp; Shl
| &nbsp; bitweises '''sh'''ift '''l'''eft &nbsp;
+
| &nbsp; bitweises '''sh'''ift '''l'''eft
 
|-
 
|-
| &nbsp; ++ &nbsp;
+
| &nbsp; ++
 
| &nbsp; Inc
 
| &nbsp; Inc
 
| &nbsp; inkrementieren (Heraufzählen)
 
| &nbsp; inkrementieren (Heraufzählen)
 
|-
 
|-
| &nbsp; -- &nbsp;
+
| &nbsp; --
 
| &nbsp; Dec
 
| &nbsp; Dec
 
| &nbsp; dekrementieren (Herunterzählen)
 
| &nbsp; dekrementieren (Herunterzählen)
 
|-
 
|-
| &nbsp; /* &nbsp;
+
| &nbsp; /*
 
| &nbsp; {
 
| &nbsp; {
 
| &nbsp; Anfang eines Kommentars
 
| &nbsp; Anfang eines Kommentars
 
|-
 
|-
| &nbsp; /* &nbsp;
+
| &nbsp; /*
 
| &nbsp; (*
 
| &nbsp; (*
 
| &nbsp; Anfang eines Kommentars  
 
| &nbsp; Anfang eines Kommentars  
 
|-
 
|-
| &nbsp; */ &nbsp;
+
| &nbsp; */
 
| &nbsp; }
 
| &nbsp; }
 
| &nbsp; Ende eines Kommentars
 
| &nbsp; Ende eines Kommentars
 
|-
 
|-
| &nbsp; */ &nbsp;
+
| &nbsp; */
 
| &nbsp; *)
 
| &nbsp; *)
 
| &nbsp; Ende eines Kommentars
 
| &nbsp; Ende eines Kommentars
 
|-
 
|-
| &nbsp; // &nbsp;
 
 
| &nbsp; //
 
| &nbsp; //
| &nbsp; Kommentarzeile &nbsp;
+
| &nbsp; //
 +
| &nbsp; Kommentarzeile
 
|-
 
|-
 
| &nbsp; public static void main(String[] args) { }
 
| &nbsp; public static void main(String[] args) { }
Line 92: Line 92:
 
| &nbsp; Unterprogramm
 
| &nbsp; Unterprogramm
 
|-
 
|-
| &nbsp; someType arrayVar[];
+
| &nbsp; someType arrayVar[]
| &nbsp; arrayVar: Array Of someType;
+
| &nbsp; arrayVar: Array Of someType
 
| &nbsp;
 
| &nbsp;
 
|-
 
|-
| &nbsp; someType arrayVar[#];
+
| &nbsp; someType arrayVar[#]
| &nbsp; arrayVar: Array[MINRANGE..MAXRANGE] Of someType;
+
| &nbsp; arrayVar: Array[MINRANGE..MAXRANGE] Of someType
 
| &nbsp;
 
| &nbsp;
 
|-
 
|-
Line 113: Line 113:
 
|-
 
|-
 
| &nbsp; class TheClass { }
 
| &nbsp; class TheClass { }
| &nbsp; TheClass = Class End;
+
| &nbsp; TheClass = Class End
 
| &nbsp; FPC / Delphi
 
| &nbsp; FPC / Delphi
 
|-
 
|-
 
| &nbsp; class TheClass { }
 
| &nbsp; class TheClass { }
| &nbsp; TheClass = Object End;
+
| &nbsp; TheClass = Object End
 
| &nbsp; FPC / Turbo Pascal
 
| &nbsp; FPC / Turbo Pascal
 
|-
 
|-
 
| &nbsp; class TheClass<T> { }
 
| &nbsp; class TheClass<T> { }
| &nbsp; Generic TheClass = Class<T> End;
+
| &nbsp; Generic TheClass = Class<T> End
 
| &nbsp; Generische werden Klassen erst ab FPC 2.2.2 unterstützt
 
| &nbsp; Generische werden Klassen erst ab FPC 2.2.2 unterstützt
 
|-
 
|-
Line 132: Line 132:
 
| &nbsp;  
 
| &nbsp;  
 
|-
 
|-
| &nbsp; do while  ! &nbsp;
+
| &nbsp; do while  !
| &nbsp; Repeat Until Not &nbsp;
+
| &nbsp; Repeat Until Not
 
| &nbsp;
 
| &nbsp;
 
|-
 
|-
| &nbsp; do while &nbsp;
+
| &nbsp; do while
| &nbsp; Repeat Until &nbsp;
+
| &nbsp; Repeat Until
 
| &nbsp;
 
| &nbsp;
 
|-
 
|-
| &nbsp; enum TheEnum&nbsp;
+
| &nbsp; enum TheEnum
| &nbsp; TheEnum = ( MINVALUE .. MAXVALUE ); &nbsp;
+
| &nbsp; TheEnum = ( MINVALUE .. MAXVALUE )
 
| &nbsp;
 
| &nbsp;
 
|-
 
|-
| &nbsp; enum TheEnum = {MINVALUE, MAXVALUE}&nbsp;
+
| &nbsp; enum TheEnum = {MINVALUE, MAXVALUE}
| &nbsp; TheEnum = ( MINVALUE, MAXVALUE ); &nbsp;
+
| &nbsp; TheEnum = ( MINVALUE, MAXVALUE )
 
| &nbsp;
 
| &nbsp;
 
|-
 
|-
| &nbsp; TheEnum enumVar; &nbsp;
+
| &nbsp; TheEnum enumVar
| &nbsp; enumVar := Set Of TheEnum; &nbsp;
+
| &nbsp; enumVar := Set Of TheEnum
 
| &nbsp;
 
| &nbsp;
 
|-
 
|-
Line 160: Line 160:
 
| &nbsp;
 
| &nbsp;
 
|-  
 
|-  
| &nbsp; for ++ &nbsp;
+
| &nbsp; for ++
 
| &nbsp; For To Do
 
| &nbsp; For To Do
 
| &nbsp;
 
| &nbsp;
 
|-
 
|-
| &nbsp; for -- &nbsp;
+
| &nbsp; for --
| &nbsp; For Downto Do &nbsp;
+
| &nbsp; For Downto Do
 
| &nbsp;
 
| &nbsp;
 
|-
 
|-
| &nbsp; if() &nbsp;
+
| &nbsp; for each
 +
| &nbsp; For in
 +
| &nbsp;
 +
|-
 +
| &nbsp; if()
 
| &nbsp; If Then
 
| &nbsp; If Then
 
| &nbsp;
 
| &nbsp;
 
|-
 
|-
| &nbsp; if() else &nbsp;
+
| &nbsp; if() else
 
| &nbsp; If Then Else
 
| &nbsp; If Then Else
 
| &nbsp;
 
| &nbsp;
Line 200: Line 204:
 
| &nbsp; Nur für Unix
 
| &nbsp; Nur für Unix
 
|-
 
|-
| &nbsp; new primitive_type[#];
+
| &nbsp; new primitive_type[#]
| &nbsp; SetLength(ArrayVar, #);
+
| &nbsp; SetLength(ArrayVar, #)
| &nbsp;  &nbsp;
+
| &nbsp;
 
|-
 
|-
| &nbsp; new Class();
+
| &nbsp; new Class()
| &nbsp; InstanceVar := TheClass.Create;
+
| &nbsp; InstanceVar := TheClass.Create
| &nbsp;  &nbsp;
+
| &nbsp;
 
|-
 
|-
| &nbsp; package pkgName;
+
| &nbsp; package pkgName
 
| &nbsp; Unit unitName; Interface Implementation End.
 
| &nbsp; Unit unitName; Interface Implementation End.
 
| &nbsp;
 
| &nbsp;
Line 229: Line 233:
 
|-
 
|-
 
| &nbsp; return
 
| &nbsp; return
| &nbsp; Result:=
+
| &nbsp; Result :=
 
| &nbsp; ObjFPC Modus oder Delphi Modus
 
| &nbsp; ObjFPC Modus oder Delphi Modus
 
|-
 
|-
Line 248: Line 252:
 
| &nbsp; Ruft den Elternkonstruktor auf
 
| &nbsp; Ruft den Elternkonstruktor auf
 
|-
 
|-
| &nbsp; switch case break &nbsp;
+
| &nbsp; switch case break
 
| &nbsp; Case Of End  
 
| &nbsp; Case Of End  
 
| &nbsp;
 
| &nbsp;
 
|-
 
|-
| &nbsp; switch case break default &nbsp;
+
| &nbsp; switch case break default
| &nbsp; Case Of Else End &nbsp;
+
| &nbsp; Case Of Else End
 
| &nbsp;
 
| &nbsp;
 
|-
 
|-
Line 292: Line 296:
 
| &nbsp;
 
| &nbsp;
 
|-
 
|-
| &nbsp; while &nbsp;
+
| &nbsp; while
 
| &nbsp; While Do
 
| &nbsp; While Do
 
| &nbsp;
 
| &nbsp;

Revision as of 19:53, 25 March 2013

Deutsch (de) English (en)

Übersetzen von gemeinsamen Programm-Teilen

Die folgende englisch sprachige Seite zeigt, wie gemeinsame Probleme in verschiedenen Programmiersprachen, einschließlich Java und FreePascal / Object Pascal gelöst werden können.
Rosetta Code

Übersetzen von Java Stichwörtern / Konzepten

Java Pascal Kommentare
  {   Begin   Anfang eines Anweisungsblocks
  }   End   Ende / Abschluss eines Anweisungsblocks
  =   :=   Zuweisung
  ==   =   Gleich
  /   /   Division
  %   Mod   Modulo (Division ohne Rest)
  !   Not   Nichten (Den Wahrheitswert in sein Gegenteil ändern)
  !=   <>   ungleich
  &&   And   logisches UND
  ||   Or   logisches ODER
  ^   Xor   exclusives ODER
  >>   Shr   bitweises shift right
  <<   Shl   bitweises shift left
  ++   Inc   inkrementieren (Heraufzählen)
  --   Dec   dekrementieren (Herunterzählen)
  /*   {   Anfang eines Kommentars
  /*   (*   Anfang eines Kommentars
  */   }   Ende eines Kommentars
  */   *)   Ende eines Kommentars
  //   //   Kommentarzeile
  public static void main(String[] args) { }   Program ProgramName; Begin End.   Unterprogramm
  someType arrayVar[]   arrayVar: Array Of someType  
  someType arrayVar[#]   arrayVar: Array[MINRANGE..MAXRANGE] Of someType  
  null   Nil  
  abstract   Abstract  
  break   Break  
  class TheClass { }   TheClass = Class End   FPC / Delphi
  class TheClass { }   TheClass = Object End   FPC / Turbo Pascal
  class TheClass<T> { }   Generic TheClass = Class<T> End   Generische werden Klassen erst ab FPC 2.2.2 unterstützt
  TheClass()   Constructor CtorName   Der Name des Konstructors ist entweder Init oder Create
  continue   Continue  
  do while !   Repeat Until Not  
  do while   Repeat Until  
  enum TheEnum   TheEnum = ( MINVALUE .. MAXVALUE )  
  enum TheEnum = {MINVALUE, MAXVALUE}   TheEnum = ( MINVALUE, MAXVALUE )  
  TheEnum enumVar   enumVar := Set Of TheEnum  
  extends   SubClass = Class(BaseClass)  
  final   Const  
  for ++   For To Do  
  for --   For Downto Do  
  for each   For in  
  if()   If Then  
  if() else   If Then Else  
  implements   SomeClass = Class(SomeInterface)  
  import   Uses  
  instanceof   Is  
  interface   TheInterface = Interface  
  native   StdCall   Nur für Windows
  native   CDecl   Nur für Unix
  new primitive_type[#]   SetLength(ArrayVar, #)  
  new Class()   InstanceVar := TheClass.Create  
  package pkgName   Unit unitName; Interface Implementation End.  
  private   Private  
  protected   Protected  
  public   Public  
  return   FunctionName :=  
  return   Result :=   ObjFPC Modus oder Delphi Modus
  static   Static  
  static   Class Function  
  static   Class Procedure  
  super   Inherited   Ruft den Elternkonstruktor auf
  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  

Translating Java data types

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   LongInt   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   2 Zeichen codieren ein sichtbares Zeichen
  String   String    

--Olaf 14:28, 24 March 2013 (UTC)