on-internet
← Community

Do I need static for a constant in an interface and would I need a reference as an interface and instantiate it using a different class' constructor?

Stack Overflow ·

I am trying to create interface Cost and included test class Car: public class Car implements Cost{ private String make; private int year; private String model; private double stickerPrice; public Car(){ make = ""; model = ""; year = 1950; stickerPrice = 0; } public String getMake(){ return make; } public String getModel(){ return model; } public int getYear(){ return year; } public void setCost(double c){ stickerPrice = c + SHIPPING_FEE; } public void setMake(String make){ this.make = make; } public void setModel(String model){ this.model = model; } public void setYear(int year){ this.year =

Comments

Sign in or sign up to comment and upvote.

No comments yet.