-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFordon.java
More file actions
42 lines (25 loc) · 779 Bytes
/
Fordon.java
File metadata and controls
42 lines (25 loc) · 779 Bytes
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
import java.io.Serializable;
public class Fordon implements Serializable {
/**
*
*/
private static final long serialVersionUID = -4447832786903084781L;
private Person agare;
private String typ;
private String marke;
private String regNr;
public Fordon(String typ,String marke,String regNr,Person agare) {
this.typ=typ;
this.marke=marke;
this.regNr=regNr;
this.agare=agare;
}
public String toString() {
return "Ägare: "+ agare.getName() + ", fordonstyp: " + typ + ", marke: " +marke + ", regNummer: " + regNr;
}
public static void main(String[] args) {
Person agare = new Person("Ahmad",25);
Fordon fordon = new Fordon("sport", "bmw","abc",agare);
System.out.println(fordon.toString());
}
}