Tugas modul 2

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package modul2;

/**
 *
 * @author Devanda L120
 */
public class Mahasiswa {
    String nama;
   
void isiNama(String nama){
    this.nama = nama;
}

String tampilkanNama(){
    return this.nama;
}
   
}
penentuakses.java

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package modul2;

/**
 *
 * @author Devanda L120
 */
public class PenentuAkses {
    public static void main (String [] args){
        Mahasiswa saya = new Mahasiswa();
        saya.isiNama("Devanda Andrevianto");
        System.out.println(saya.nama);
        System.out.println(saya.tampilkanNama());
    }
   
}

Tidak ada komentar:

Posting Komentar