Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
getListVehicules
//'main' method must be in a class 'Rextester'. //Compiler version 1.8.0_111 import java.util.*; import java.lang.*; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.ListIterator; class Vehicule { private int id; private String type; private String immat; public static ArrayList<Vehicule> getListVehicules() { ArrayList<Vehicule> list = new ArrayList<Vehicule>(); for(int i=0;i<5;i++) { list.add(new Vehicule(i,"C4","QQ ZZ 36")); } return list; } public Vehicule(int id, String type, String immat) { super(); this.id = id; this.type = type; this.immat = immat; } public void setType(String type) { this.type = type; } public String getType() { return type; } public String getImmat() { return immat; } public void setImmat(String immat) { this.immat = immat; } public String toString() { return "id:" + id + " - Type:" + type + " - Immat:" + immat; } } class Event { private int id; private boolean uso; private String etat; public Event(int id, String type) { this.id = id; this.uso = type.equals("uso"); if (this.uso) etat="en attente"; if (id==4) etat="indispo"; } public void setEtat(String etat) { this.etat = etat; } public String getEtat() { return etat; } public void setId(int id) { this.id = id; } public int getId() { return id; } public void setUso(boolean uso) { this.uso = uso; } public boolean isUso() { return uso; } public String toString() { return "id:" + id + " - uso:" + uso + " - etat:" + etat; } } class Rextester { public static List<Event> list; public static void main(String args[]) { Event evt = new Event(5,"uso"); int id = evt.getId(); for(Vehicule v : Vehicule.getListVehicules()) System.out.println(v.toString()); } }
run
|
edit
|
history
|
help
0
Write a program to sort the odd elements descending order and even elements in ascending order
dimond of stars
Find kth element from last in a singly linked list
jb11.0 threads tick tock 1.0
twelveDays
Graph adjacency list representation
PE #9
With unicode change
Java
Edna Garcia