TextFile
[Line 1] a=5
[Line 2] b=2
[Line 3] c=3
[Line 4] a+b*c
I want to read and output only the Line 4. How?
And also, I want to read and pass those a=5, b=2, c=3 into an Integer values(variables)
public static void main(String[] args) throws IOException {
try {
File file = new File("D:\\TextFile.txt");
FileReader fileReader = new FileReader(file);
BufferedReader bufferedReader = new BufferedReader(fileReader);
StringBuffer stringBuffer = new StringBuffer();
String line;
while ((line = bufferedReader.readLine()) != null) {
stringBuffer.append(line);
}
fileReader.close();
String input = stringBuffer.toString();
String output;
InToPost theTrans = new InToPost(input);
output = theTrans.doTrans();
System.out.println("Postfix is: " + output + '\n');
} catch (IOException e) {
e.printStackTrace();
}
}