I have a Bean class that calls 2 seperate DAO's to pull info from DB. This is the structure
class InfoRetriever {
public String retrieveInfo(int arg1, int arg2){
String info = retrieveFirstInfo(arg1 , arg2);
if(info.equals("xyz")){
retrieveSecondInfo(arg1, arg2);
}
}
private String retrieveFirstInfo(int arg1,String arg2){
// call DB to get info
}
private String retrieveSecondInfo (int arg1, String arg2) {
// call DB to get info
}
}
My questions is that i have a choice to move arg1 and arg2 as member elements and can set them before calling retrieveFirstInfo and retrieveSecondInfo . I can also make info as member variable.
What are the trade offs to be considered if there is a choice to keep a variable local to the method vs class variable.
retrieveInfomethod would also be receiving those arguments from the caller right? Check the syntax there. You are missing().