次のスクリプトでは、java.lang.Integer クラスに属する toString メソッドの番号が出力されます。
Dim mySession As JavaSession
Dim myClass As JavaClass
Dim myMCollection As JavaMethodCollection
Dim Count As Integer
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()
Count = 0
ForAll m in myMCollection
If m.MethodName = "toString" Then
Count = Count + 1
End If
End ForAll
MessageBox "There are " & Count & " instances of the toString _
method in the method collection for java.lang.Integer"