Answers for "how to read text file as variable in java"

0

how to read text file as variable in java

public static void readAsString() {
			 String lCurentDir = System.getProperty("user.dir")+"/aa.txt";
			 FileReader fr;
			try {
				fr = new FileReader(lCurentDir);
				 BufferedReader br = new BufferedReader(fr);
		            String s="";
		            s=br.readLine();
		            System.out.println(s);
			} catch (FileNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
	           

		}
Posted by: Guest on March-31-2021

Code answers related to "how to read text file as variable in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language