1. Create satu class dibawah package action;
2. Declare object staff sebagai satu data type;
--- format : {class} {variable} = new {class}();
--- cth : staff pStaff = new staff();
3. Kalau object staff letak di bawah package lain kena letak import statement;
--- format : import {package}.{class};
--- cth : import form.staff; /*nama package adalah form
4. Untuk guna class
--- format - assign value : {variable}.{setters variable}("{value}");
--- cth : pStaff.setStaffID("11111");
--- format - display value : {variable}.{getters variable}();
--- cth : pStaff.getStaffID();
package action;
public class admin {
public static void main(String[] args) {
staff pStaff = new staff();
pStaff.setStaffID("11111");
pStaff.setStaffName("ALI");
System.out.println ("ID Name ") + pStaff.getStaffID());
}
}
LATIHAN : Paparkan nama staff.
No comments:
Post a Comment