-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.java
44 lines (38 loc) · 1.31 KB
/
main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
* 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 latihan1;
/**
* main.java - satu package dengan shinobi.java
* @author RIVANDWIARHIANSYAH-18102068
*/
public class Main {
public static void main(String[] args) {
Shinobi[] s = new Shinobi[3];
//membentuk objek1
s[0] = new Shinobi();
s[0].setNoregistrasi("012606");
s[0].setNama("Uchiha Sasuke");
s[0].setPeringkat("Genin");
//membentuk objek ke-2
s[1] = new Shinobi();
s[1].setNoregistrasi("012607");
s[1].setNama("Uzumaki Naruto");
s[1].setPeringkat("Genin");
//membentuk objek ke-3
s[2] = new Shinobi();
s[2].setNoregistrasi("012601");
s[2].setNama("Haruno Sakura");
s[2].setPeringkat("Genin");
//menampilak ketiga objek dari array
System.out.println("Data Diagram Shinobi \n");
for (Shinobi x:s) {
System.out.println("No.Registrasi : "+x.getNoregistrasi());
System.out.println("Nama : "+x.getNama());
System.out.println("Peringkat : "+x.getPeringkat());
System.out.println("");
}
}
}