Switch to full style
Java2 codes,problems ,discussions and solutions are here
Post a reply

how to call a global variable?

Fri Oct 24, 2008 12:30 pm

hi i am new using eclipse and i was wondering if somebody knows how to
call a global variable that is declare in x class in a different class?



Re: how to call a global variable?

Fri Oct 24, 2008 12:31 pm

What is even better is the bean pattern. Basically, all elements are
private and have getter/setter accessors. This is how Java and JSP work
together, for the most part. Example:

Code:
public class myBean {
private String myString = "";
private int myInt = 0;

public String getMyString () {
return myString;
}

public void setMyString (String myString) {
this.myString = myString;
}

public int getMyInt () {
return myInt;
}

public void setMyInt (int myInt) {
this.myInt = myInt;
}
}

Then, anyone on the outside can set or get the bean properties using the
method calls.

Post a reply
  Related Posts  to : how to call a global variable?
 different between Local variable and Global variable     -  
 Accessing Global Variables with the global Statement     -  
 global statement in php     -  
 dynamic array as global variables     -  
 Page Call MySelf PHP     -  
 Make a call using java     -  
 Call PHP code from JSP Page     -  
 How i can transfer voice during call from phone to PC?     -  
 General call (Invoke) to method     -  
 How i can transfer voice during call from phone to PC?     -  

Topic Tags

Java Basics, Java Variables