我正在做一个项目,我需要从“行程”类型的文件中扫描一个值,但我不知道该怎么做。这是我的代码:
switch (idChar) {
case 'B':
flightNumIn = scanFile.next();
tripDataIn = scanFile.next();
baseFareIn = scanFile.nextDouble();
fareAdjustmentFactorIn = scanFile.nextDouble();
foodBeveragesIn = scanFile.nextDouble();
entertainmentIn = scanFile.nextDouble();
Business bTicket1 = new Business(flightNumIn, tripDataIn,
baseFareIn, fareAdjustmentFactorIn, foodBeveragesIn,
entertainmentIn);
break;
而实际的错误:
AirTicketProcessor.java:43: error: incompatible types
tripDataIn = scanFile.next();
^
required: Itinerary
found: String