次のスクリプトは、toString メソッドがあるコレクション内での位置を出力します。
Dim mySession As JavaSession
Dim myClass As JavaClass
Dim myMethod As JavaMethod
Dim myMCollection As JavaMethodCollection
Dim msg As String
Set mySession = new JavaSession()
msg = " "
' Get Java "java.lang.Integer" class
Set myClass = mySession.GetClass("java/lang/Integer")
' Get a list of all methods belonging
' to the java.lang.Integer class
Set myMCollection = myClass.getClassMethods()
set myMethod = myMCollection.getFirst()
do
if myMethod.MethodName = "toString" then
msg = msg + {
toString } & myMethod.Signature & _
{ is located at element } & _
myMCollection.Current & _
{ within the collection}
End If
set myMethod = myMCollection.getNext()
loop while myMCollection.Current <> 1
' Because getNext loops back to 1 when the end is reached
MessageBox msg