次のスクリプトは、toString メソッドがあるコレクション内での位置を出力します。
Dim mySession As JavaSession
Dim myClass As JavaClass
Dim myMethod As JavaMethod
Dim myMCollection As JavaMethodCollection
Set mySession = new JavaSession()
' 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
Print "toString" & myMethod.Signature & _
" is located at the " & myMCollection.Current & _
" element 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