Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

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();
			}
	           

		}
Comment

PREVIOUS NEXT
Code Example
Java :: android search in webview 
Java :: wait method in java 
Java :: add two variables in Java 
Java :: abstract code in java 
Java :: java stringbuilder set value 
Java :: program to check if the given date is in in the format dd/mm/yyyy java 
Java :: create hashmap in java 
Java :: Hash map, Hash set and Hash Table difference 
Java :: exception in thread "main" java.lang.unsupportedclassversionerror: has been compiled by a more recent version of the java runtime (class file version 55.0), this version of the java runtime only recognizes class file versions up to 52.0 
Java :: what is static setter and getter examples in java 
Java :: simple for loop 
Java :: draw circle with fill java 
Java :: write file java 
Java :: initilize an array java 
Java :: Remove an element at a specific index from an array in Java 
Java :: align button to the left in JPanel 
Java :: app "restart" the home activity (and dismiss all other activities). 
Java :: crit chance in java 
Java :: convert linkedlist to integer array java 
Java :: how to convert infix to postfix and prefix in java 
Java :: export java command in linux 
Java :: spring data sql not utf8 
Java :: implements java 
Java :: compress a directory in java 
Java :: java integer division to float 
Java :: java creare costante 
Java :: Implement the static keyword – static variable, static block, static function and static class with following conditions 
Java :: show all spring boot beans 
Java :: difference between two sets java 
Java :: kotlin edittext default value 
ADD CONTENT
Topic
Content
Source link
Name
9+2 =