Move the definitions of the variables so they are in scope. That usually means putting the definitions within the same set of {}s.
The first set of {}s is for a class.
The next set of {}s is for...
Type: Posts; User: Norm
Move the definitions of the variables so they are in scope. That usually means putting the definitions within the same set of {}s.
The first set of {}s is for a class.
The next set of {}s is for...
your problem is with the scope of the definitions of the variables. The definition is NOT known outside of the enclosing {}s.
{ // begin scope for x
int x = 20;
} // end scope for x
//...
That's a problem with some IDEs. The don't give you error messages that can be copied to a forum where you are asking for help. Until you can get a listing of the compiler's error mesages, you'll...
You need to post the full text of the compiler's error message that shows the line where the error occurred and the symbol that is not found.
Here is a sample:
TestSorts.java:138: cannot...
When you get errors, you need to copy the full text of the error messages and paste it here so we can see what the errors are.