简体   繁体   English

如何从readline()方法打印结果

[英]How to i print the result from the readline() method

I'm trying to print out the result from the readline method in a certain format. 我试图以某种格式打印出readline方法的结果。 I also need to add two more if statements, but I'm not sure how to get the code to continue through them if the previous one is true. 我还需要添加两个if语句,但是我不知道如果前一个是真的,如何让代码继续通过它们。

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) {

                    }
                }

You can do the following: 您可以执行以下操作:

if (condition) {

} else {
   if (condition2) {}
   else {}

   if (condition3) {}
   else {}
}

You can place an if inside the else of another one. 你可以将if放在另一个的else中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM