-4

オークションの localdate をフォーマットするにはどうすればよいですか。コンストラクターを文字列に変更するように求めるエラーが引き続き発生しますが、LocalDate にする必要があります

public static void main(String[] args) {

    user1 = new User("fred", "fredbloggs");
    user2 = new User("joe", "joebloggs");
    auction1 = new Auction(1000.00, 5000.00, 2017-04-05);
    auction2 = new Auction(30.00, 80.00,  );
    item1 = new Item("Car - Honda Civic VTI 1.8 Petrol");
    item2 = new Item("Sony Bluetooth Speakers");
4

2 に答える 2

0

これを行う 1 つの方法は、エラーの内容に従って、コンストラクターを文字列に変更することです。

auction1 = new Auction(1000.00, 5000.00, "2017-04-05");
//rest of code


//then change the class definition 
public class Auction{
  LocalDate auctionDate;
  //declare other members here

  public Auction(int startingPrice,int buyoutPrice,String auctionDate){
  this.auctionDate=auctionDate;
  //set up other members accordingly
  }
}
于 2017-03-23T12:49:08.357 に答える