0
list.loadRequestParms(request, 'a', 20);

This method takes three parameters

  1. a request object.
  2. a char
  3. an integer

Now how to define these as constants somewhere and use it in this method.

John
  • 1,191
  • 3
  • 19
  • 29
  • 4
    It really looks like a homework, and I didn't understand what your want to do. – Colin Hebert Oct 17 '10 at 19:11
  • 1
    possible duplicate of [What is the best way to implement constants in Java ?](http://stackoverflow.com/questions/66066/what-is-the-best-way-to-implement-constants-in-java) – Colin Hebert Oct 17 '10 at 19:21

3 Answers3

3

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.

Codemwnci
  • 54,176
  • 10
  • 96
  • 129
  • static and final is what makes a constant in Java. Static means that it is shared by all instances of the Object, rather than creating a new copy for each instance (which is pointless if it is constant), and final means it cannot change (which is required for a constant). – Codemwnci Oct 17 '10 at 19:19
2

How to define constants in Java - tutorial.

Passing parameters in Java - an article.

Oded
  • 489,969
  • 99
  • 883
  • 1,009
0

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 publicly accessible.

http://www.devx.com/tips/Tip/12829

public class MaxUnits {
   public static final int MAX_UNITS = 25;
}
Jungle Hunter
  • 7,233
  • 11
  • 42
  • 67