ABAP Objects vs Java: Hello World

Mungkin ada yang ingin tahu perbandingan OOP antara ABAP Objects dengan Java untuk program “Hello World”. Pada ABAP, bagian deklarasi class dipisahkan dengan bagian implementasi class (mirip Delphi).

 REPORT  z_oo_hello_world.

 *----------------------------------------------------------------------*
 *       CLASS welcome DEFINITION
 *----------------------------------------------------------------------*
 CLASS welcome1 DEFINITION CREATE PUBLIC"public class
   PUBLIC SECTION.
     CLASS-METHODS main.                  "public static void method
 ENDCLASS.

 *----------------------------------------------------------------------*
 *       CLASS welcome IMPLEMENTATION
 *----------------------------------------------------------------------*
 CLASS welcome1 IMPLEMENTATION.
   METHOD main.
     WRITE 'Hello World!'.
   ENDMETHOD.
 ENDCLASS.

 START-OF-SELECTION.  "Execute main
   welcome1=>main( ).

 *----------------------------------------------------------------------*
 *       Compare to Java
 *----------------------------------------------------------------------*
 * public class welcome1 {
 *     public static void main(String[] args) {
 *         System.out.println( "Hello World!" );
 *     }
 * }
Ditulis dalam Java, SAP. Tag: , , . Leave a Comment »