Modul 1. Lat1

 * To change this template, choose Tools | Templates
 * and open the template in the editor.

package latihan1;
class Mahasiswa{
    //variabel instan
    String nama;
    void isiData(String nama){
        this.nama =nama;
    String ambilNama(){
        return this.nama;
 * @author Arya danu
public class Main {

     * @param args the command line arguments
    public static void main(String[] args) {
        // TODO code application logic here
        Mahasiswa mhs = new Mahasiswa();
        //Mengisi variabel instan
        mhs.isiData("Ahmad Rizal Abidin");
        //menamp;ilkan nama siswa via metode
        System.out.println("Nama : " + mhs.ambilNama());
        //menampilkan nama siswa via variabel
        System.out.println("nama : " + mhs.nama);

2 Responses

  1. Siang Pak….
    Maaf Pak mautanya….siapa nama pengarang buku PHP yang bagus……yang mengupas habis tentang PHP…
    Terima kasih sebelumnya….

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: