Amit
asked on
Issues with the scope of a variable
Hi,
In the attached file I have the following function which is a void. But I want to store the max_session_state in such a way that in can be accessed globally anywhere in the code.
Or can can be a protected class member of a new class say SessionTask class but I should be able to access this from an accessor method anywhere in the code
I am hitting a dead end here. Any help ? Also can someone point me to a really good tutorial on scope of a variable and how to handle multiple scenarios with it
thanks
-anshu
public void characters(char ch[], int start, int length) throws SAXException {
if (max_state) {
//System.out.println("Max Session State : " + new String(ch, start, length));
String max_session_state=new String(ch, start, length);
System.out.println("Max Session State : " + max_session_state );
max_state = false;
}
java-scop.txt
In the attached file I have the following function which is a void. But I want to store the max_session_state in such a way that in can be accessed globally anywhere in the code.
Or can can be a protected class member of a new class say SessionTask class but I should be able to access this from an accessor method anywhere in the code
I am hitting a dead end here. Any help ? Also can someone point me to a really good tutorial on scope of a variable and how to handle multiple scenarios with it
thanks
-anshu
public void characters(char ch[], int start, int length) throws SAXException {
if (max_state) {
//System.out.println("Max Session State : " + new String(ch, start, length));
String max_session_state=new String(ch, start, length);
System.out.println("Max Session State : " + max_session_state );
max_state = false;
}
java-scop.txt
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.