次のスクリプトでは、java.lang.Integer クラスに属する toString メソッドの番号が出力されます。
Dim mySession As JavaSession
Dim myClass As JavaClass
Dim myMethod As JavaMethod
Dim myMCollection As JavaMethodCollection
Dim Count As Integer, i 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()
For i = 1 to myMCollection.count
Set myMethod = myMCollection.getNth(i)
If myMethod.MethodName = "toString" then
Count = Count + 1
End If
Next
Print "There are " & Count & " instances of the toString " + _
"method in the Method collection for java.lang.Integer"