Sorry for stupid question... Could anybody help me with returning two variable from method (I read here and tried to recode but without result).
public class FileQualityChecker { EnviroVars vars = new EnviroVars(); public int n = 0; public int z = 0; public int m = 0; String stringStatus; public void stringLenghtCheck(String pathToCheckedFile) { try{ FileInputStream fstream = new FileInputStream(pathToCheckedFile+"\\"+"Test.dat"); // Get the object of DataInputStream DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String strLine; //Read File Line By Line while ((strLine = br.readLine()) != null) { if ( strLine.length() == vars.strLenghtH || strLine.length() == vars.strLenghtCUoriginal || strLine.length() == vars.strLenghtCEAoriginal || strLine.length() == vars.strLenghtCAoriginal || strLine.length() == vars.strLenghtTrailer || strLine.length() == vars.strLenghtLastRow ) { stringStatus = "ok"; n++; z++; } else { stringStatus = "Fail"; n++; m++; } System.out.println (n +" " + strLine.length() +" " + stringStatus); } //Close the input stream in.close(); } catch (Exception e){//Catch exception if any System.err.println("Error: " + e.getMessage()); } /*How to return m and z from method to use these vars for writing in the file*/ return (m, z); } } I need m and z in another class for write them into file. Thank you.
tabin your code. I hate tabs... Totally different settings depending on your favorite IDE. Just use spaces instead.