lis开发者_StackOverflow社区t.loadRequestParms(request, 'a', 20);
This method takes three parameters
- a request object.
- a char
- an integer
Now how to define these as constants somewhere and use it in this method.
I think I understand what you mean, but more detail would have been useful.
static final Request MY_REQUEST_CONST = someRequest;
static final char MY_A_CONST = 'a';
static final int MY_INT_CONST = 20;
list.loadRequestParms(MY_REQUEST_CONST, MY_A_CONST, MY_INT_CONST);
Some things to note. A constant in Java is created by the final static keywords. Convention suggests that constant variable names are uppercase.
How to define constants in Java - tutorial.
Passing parameters in Java - an article.
Constants? You mean variables that don't change and are final
? Same copy of which lasts all throughout, i.e. are static
? And they can also be public
ly accessible.
http://www.devx.com/tips/Tip/12829
public class MaxUnits {
public static final int MAX_UNITS = 25;
}
精彩评论