Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. public interface Vehicle {
  2. public double getVehicleWeight();
  3. }
  4.  
  5. public class Car implements Vehicle{
  6. private final long carWeight;
  7.  
  8. //constructor here...
  9.  
  10. @Override
  11. public double getVehicleWeight() {
  12. return this.carWeight;
  13. }
  14.  
  15. }
  16.  
  17. TreeMap<String,Vehicle> vehicles = new TreeMap<String,Vehicle>();
  18. vehicles.put("AXK-KF1",new Car(...));
  19. System.out.println(vehicles.get("AXK-KF1").getVehicleWeight());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement