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

From Free Pascal wiki
Jump to navigationJump to search
Line 299: Line 299:
 
== Translating Java data types ==
 
== Translating Java data types ==
 
{| class="wikitable"
 
{| class="wikitable"
! Java type !! [[Pascal/de|Pascal]] [[Data_type/de|type]] !! Size (bits) !! Range !!
+
! Java type !! [[Pascal/de|Pascal]] [[Data_type/de|type]] !! Size (bits) !! Range
 
|-
 
|-
|   byte  
+
|   byte
 
|   Shortint
 
|   Shortint
 
|   8-bit
 
|   8-bit
 
|   -128 .. 127
 
|   -128 .. 127
|  
 
 
|-
 
|-
|   short  
+
|   short
 
|   SmallInt
 
|   SmallInt
 
|   16-bit
 
|   16-bit
|   -32768 .. 32767  
+
|   -32768 .. 32767
 
|-
 
|-
|   int  
+
|   int
 
|   LongInt
 
|   LongInt
 
|   32-bit
 
|   32-bit
|   -2147483648..2147483647  
+
|   -2147483648..2147483647  
|   
 
 
|-
 
|-
|   int  
+
|   int
 
|   LongInt
 
|   LongInt
 
|   32-bit
 
|   32-bit
|   -2147483648..2147483647  
+
|   -2147483648..2147483647
|   
 
 
|-
 
|-
|   long  
+
|   long
 
|   Int64
 
|   Int64
 
|   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  
|   
 
 
|-
 
|-
|   float  
+
|   float
 
|   Single
 
|   Single
 
|   32-bit
 
|   32-bit
|   1.5E-45 .. 3.4E+38  
+
|   1.5E-45 .. 3.4E+38
|
 
 
|-
 
|-
|   double  
+
|   double
 
|   Double
 
|   Double
 
|   64-bit
 
|   64-bit
|   5.0E-324 .. 1.7E+308  
+
|   5.0E-324 .. 1.7E+308
|
 
 
|-
 
|-
|   boolean  
+
|   boolean
 
|   Boolean
 
|   Boolean
 
|    
 
|    
 
|   False True
 
|   False True
|  
 
 
|-
 
|-
|   char  
+
|   char
 
|   WideChar
 
|   WideChar
 
|   16-bit
 
|   16-bit
 
|   2 Zeichen codieren ein sichtbares Zeichen
 
|   2 Zeichen codieren ein sichtbares Zeichen
|  
 
 
|-
 
|-
|   String  
+
|   String
 
|   String
 
|   String
 
|    
 
|    

Revision as of 16:35, 24 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    
  }     End  
  =     :=   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    
  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)