Advertisement
Guest User

Untitled

a guest
Nov 15th, 2019
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. public static void main(String[] args) {
  2.  
  3. try (PrintWriter writer = new PrintWriter(new File("test.csv"))) {
  4. StringBuilder sb = new StringBuilder();
  5. sb.append("id,");
  6. sb.append(',');
  7. sb.append("Name");
  8. sb.append('\n');
  9.  
  10. sb.append("1");
  11. sb.append(',');
  12. sb.append("Prashant Ghimire");
  13. sb.append('\n');
  14.  
  15. writer.write(sb.toString());
  16.  
  17.  
  18.  
  19. } catch (FileNotFoundException e) {
  20. System.out.println(e.getMessage());
  21. }
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement