java 导出 csv

  1. import java.io.File;   
    import java.io.FileWriter;   
    import java.io.IOException;   
      
    import au.com.bytecode.opencsv.CSVWriter;   
      
      
    public class CsvDemo {   
           
        public static void main(String[] args) throws IOException {   
               
            final String[] header = new String[]{"name", "sex", "age"};   
            final String[][] data = new String[][]{header, {"日日", "F", "22"}, {"Tom", "M", "25"}, {"Lily", "F", "19"}};   
      
             File tempFile = new File("./Output.csv");           
      
             CSVWriter writer = new CSVWriter(new FileWriter(tempFile));   
            for (int i = 0; i < data.length; i++) {   
                 writer.writeNext(data[i]);   
             }   
             writer.close();   
                
         }   
    }  
     

你可能感兴趣的:(java,F#)