step simple java programming
1.specify construktor
2.method for program
3.accessor
4.muttator
2.method for program
3.accessor
4.muttator
example scricp simple program
class Test {
// field
private String a;
private String b;
private int c;
// constructor : dgn brp cara kita bisa membuat object dr class
// inisialisasi : penentuan kondisi awal
Test() {
}
Test(String a, String b, int c) {
this.a = a;
this.b = b;
this.c = c;
}
///method
void coba1() {
System.out.println("Coba : " + a);
}
int coba2() {
return c;
}
// accessor
public String getA() {
return a;
}
// mutator
public void setA(String a) {
this.a = a;
}
}
0 komentar:
Post a Comment