Starts the Java application. @param args command line parameters
(String[] args)
| 21 | * @param args command line parameters |
| 22 | */ |
| 23 | public static void main(String[] args) { |
| 24 | String fileName = "falling.txt"; // reads from directory where DataLoaderApp is located |
| 25 | // gets the data file |
| 26 | Resource res = ResourceLoader.getResource(fileName, DataLoaderApp.class); |
| 27 | String data = res.getString(); |
| 28 | String[] lines = data.split("\n"); // split string on newline character |
| 29 | // extract x-y data from every line |
| 30 | for(int i = 0, n = lines.length;i<n;i++) { |
| 31 | if(lines[i].trim().startsWith("//")) { |
| 32 | continue; // skip comment lines |
| 33 | } |
| 34 | String[] numbers = lines[i].trim().split("\\s"); // split on any white space |
| 35 | System.out.print("t = "+numbers[0]); |
| 36 | System.out.println(" y = "+numbers[1]); |
| 37 | } |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | /* |
nothing calls this directly
no test coverage detected