like this:How to call a string inside the "while loop"?
while((line = br.readLine())!=null){ String acc[] = line.split("-"); String account = acc[0]; String passcode = acc[4]; }
i would like to declare a string outside the "while loop" or "try catch" as the same as of the inner String.
try{ File file = new File("Database.txt"); BufferedReader br = new BufferedReader(new FileReader(file)); String line; while((line = br.readLine())!=null){ String acc[] = line.split("-"); String account = acc[0]; String passcode = acc[4]; } br.close(); } catch (IOException ex) { ex.printStackTrace(); }