3 September 2018

Tugas 1 PBO B

Kita bisa memprogram code Java pada software BlueJ. Berikut merupakan source code agar BlueJ dapat melakukan print out message dari sebuah program Java ini.


   
 /**  
  * Bagian dari project tugas 1, mengeprint message dari program di bawah ini.  
  *  
  * @author (Mohammad Nafis Naufally)  
  * @version (0.1/20180903)  
  */  
 public class Tugas1  
 {  
   // instance variables - replace the example below with your own  
   private int x;  
   
   /**  
    * Constructor for objects of class Tugas1  
    */  
   public Tugas1()  
   {  
     // initialise instance variables  
     x = 0;  
     System.out.println("Nama      : Mohammad Nafis Naufally");  
     System.out.println("Kelas      : PBO B");  
     System.out.println("Alamat Rumah  : Dsn. Sruni, Ds. Banjartanggul Kec. Pungging, Mojokerto");  
     System.out.println("Email      : naf1s.n4ufally@gmail.com");  
     System.out.println("Blog      : http://mnafisnaufally.blogspot.com/");  
     System.out.println("No HP/WA    : 088803216015");  
     System.out.println("Twitter     : @MNafisNaufally");  
   }  
   
   /**  
    * An example of a method - replace this comment with your own  
    *  
    * @param y a sample parameter for a method  
    * @return  the sum of x and y  
    */  
   public int sampleMethod(int y)  
   {  
     // put your code here  
     return x + y;  
   }  
 }  
   

Setelah code di atas di-compile, lalu kita run code-nya sehingga muncul pesan pada screenshot bawah ini.




Demikian tugas pertama saya pada mata kuliah Pemrograman Berbasis Objek. Terima kasih atas kunjungannya.



 Jangan lupa, semangat ketik 10 jari. :)

Tidak ada komentar:

Posting Komentar

Silahkan isi kolom komentar di bawah ini