0

So i am programming a Currency converted with GUI. and i need to import the currency parameters from a txt file that changes my preset parameters.

Below is the sample code i got from the question.

void loadFile() {       
        File file = new File("currency.txt");
       
        try {
            BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF8"));
           
            String line = in.readLine();
           
            while ( line != null ) {
                // Process 'line' (split up).
                String [] parts = line.split(",");
               
                // validate, store somewhere etc.
                line = in.readLine();    // read next line (if available)
            }
           
            in.close();
           
        } catch (Exception e) {
           
            // Something went wrong.
            String msg = e.getMessage();
           
            // show the message to the user!
        }
}

enter image description here

0 Answers0