Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- import java.util.Collections;
- public class Driver {
- public static void main(String[] args) {
- AECar eCar1 = new Pluggable("Chevy", "Volt", true, 33520, 18.4, true);
- AECar eCar2 = new Battery("Kia", "Soul", false, 17490, 30, 3);
- AECar afCar1 = new Hydrogen("Honda", "Clarity", false, 36620, 7, "null");
- AECar afCar2 = new Biofuel("Chevy", "Cruze", false, 17995, 13.5, "null");
- ArrayList<AECar> CarList = new ArrayList<AECar>();
- CarList.add(eCar1);
- CarList.add(eCar2);
- CarList.add(afCar1);
- CarList.add(afCar2);
- Collections.sort(CarList);
- System.out.println(CarList);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement