MACROMEDIA COLDFUSION MX 61-DEVELOPING COLDFUSION MX Develop Manual page 757

Developing coldfusion mx applications
Table of Contents

Advertisement

The Example class
The following Java code defines the Example class. The Java class Example has one public integer
member,
mPublicInt
class has the following public methods:
Method
ReverseString
ReverseStringArray
Add
SumArray
SumObjArray
ReverseArray
Flip
public class Example {
public
int
public Example() {
mPublicInt = 0;
}
public Example(int IntVal) {
mPublicInt = IntVal;
}
public String ReverseString(String s) {
StringBuffer buffer = new StringBuffer(s);
return new String(buffer.reverse());
}
public String[] ReverseStringArray(String [] arr) {
String[] ret = new String[arr.length];
for (int i=0; i < arr.length; i++) {
ret[arr.length-i-1]=arr[i];
}
return ret;
}
public int Add(int a, int b) {
return (a+b);
}
public float Add(float a, float b) {
return (a+b);
}
public Example Add(Example a, Example b) {
return new Example(a.mPublicInt + b.mPublicInt);
}
. Its constructor initializes
Description
Reverses the order of a string.
Reverses the order of elements in an array of strings.
Overloaded: Adds and returns two integers or floats or adds the
members of two Example class objects and returns an
mPublicInt
Example class object.
Returns the sum of the elements in an integer array.
Adds the values of the
class objects and returns an Example class object.
Reverses the order of an array of integers.
Switches a Boolean value.
mPublicInt;
to 0 or an integer argument. The
mPublicInt
members of an array of Example
mPublicInt
Using Java objects
757

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COLDFUSION MX 61-DEVELOPING COLDFUSION MX and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Coldfusion mx

Table of Contents