[英]How to Grab records from an object
I am having a very difficult time on figuring out how to get records from an object that i have passed in the path to the file. 我很难弄清楚如何从我在文件路径中传递的对象中获取记录。
import java.util.ArrayList;
import edu.trident.cpt237.recordreaper.CabRecordReaper;
public class CabOrginazer implements CabInfo
{
private final String FARE = "";
private final String GAS = "";
private final String SERVICE = "";
private final String MILES = "";
private final double VALUE = 0.0;
CabRecordReaper reaper = new CabRecordReaper("C:/CabRecords/September.txt" );
public void cabOrginazer()
{
}
@Override
public Records getType() {
// TODO Auto-generated method stub
return null;
}
@Override
public String getDate() {
// TODO Auto-generated method stub
return null;
}
@Override
public String CabId() {
// TODO Auto-generated method stub
return null;
}
@Override
public double getValue() {
// TODO Auto-generated method stub
return 0;
}
@Override
public double getPerGallonCost() {
// TODO Auto-generated method stub
return 0;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}
I have try'd using a Scanner but does not work so i took it out. 我曾尝试使用扫描仪,但无法正常工作,因此我将其取出。 I can't do any of my other methods until i can grab what is in side of that reaper.
在我可以抓住收割机旁边的东西之前,我无法执行任何其他方法。 The only methods inside of the CabRecordReaper is hasMoreRecord() which determines if there is more lines in the file.
CabRecordReaper内部的唯一方法是hasMoreRecord(),它确定文件中是否有更多行。
I'm not quite understanding your question but I think you are having difficulties with reading from a .txt file? 我不太了解您的问题,但我认为您在读取.txt文件时遇到困难吗?
try (BufferedReader reader = Files.newBufferedReader(Paths.get("path here")) {
String line = null;
while ((line = reader.readLine()) != null) {
// Add your code here.
System.out.println(true);
}
} catch (IOException e) {
e.printStackTrace();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.