Answers for "Writing constructor methods in java"

0

Writing constructor methods in java

class Vehicle {

              public int mYear;
              public String mBrand;
              public String mModel;
              public int mMiles;
              public int mPrice;

              public Vehicle(int year, String brand, String model, int miles, int price) {
                mYear = year;
                mBrand = brand;
                mModel = model;
                mMiles = miles;
                mPrice = price;
              }

              public boolean worthBuying(int maxPrice){
                return (mPrice < maxPrice);
              }

            }
Posted by: Guest on July-26-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language