Hello,
I'm pretty new to OOP and Jave and have ran into an issue on how to code some logic. I have a method that's needing to hold a local variables value upon different calls. I have tried this code but realize that Java can only use static keyword for classes. ( I think i have the code right, my code came off of a different computer that does not have internet access. I think I have remembered it correctly though.)
private float proc(int a, int b, boolean state){
if(state == true){
//do processing here
static int complete = 1;
return result;
}else{
if(complete != 1){
//do same processing here
}
// more processing
return result;
} I then switched it to this but Java won't compile it due to a possible initiation issue.
private float proc(int a, int b, boolean state){
Integer completed;
if(state == true){
//do processing here
completed = 1;
return result;
}else{
if(completed != 1){
//do same processing here
}
// more processing
return result;
} Any advice will greatly be appreciated.