1
readline
メソッドの結果を特定の形式で出力しようとしています。さらに2つの文を追加する必要がありますが、前の文が真であれば、コードをどのように処理するのかわかりません。readline()メソッドの結果を出力する方法
public static void main(String[] args) {
String csvFile = args[0]; //name of our csv file
BufferedReader br = null;
String line = "";
String cvsSplitBy = ",";
String[] columns = new String[6];
String columnLine = "";
float notToBeBelow = 12;
try {
br = new BufferedReader(new FileReader(csvFile));
if ((columnLine = br.readLine()) != null) {
columns = columnLine.split(cvsSplitBy);
while ((line = br.readLine()) != null) {
// use comma as separator
String[] routerInfo = line.split(cvsSplitBy);
if (routerInfo[2].toLowerCase().equals("no")) {
float OSVersion = Integer.parseInt(routerInfo[3]);
if(OSVersion >= 12) {
}
}
あなたは 'System.out.println()'を探していますか? – David
あなたのコードから、 'String [] routerInfo = line.split(cvsSplitBy);'ならば、配列はコンマのない行で2より小さくてもよく、 'routerInfo [2]'は[IndexOutOfBoundsException](https://docs.oracle.com/javase/7/docs/api/java/lang/IndexOutOfBoundsException.html) – Bonatti