Sub Class_Globals
Private joNative As JavaObject
End Sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize
joNative = Me
End Sub
Public Sub DemoStringJava As String
Return joNative.RunMethod("DemoStringJava", Null)
End Sub
Public Sub DemoArrayJava As String()
Return joNative.RunMethod("DemoArrayJava", Null)
End Sub
Public Sub SumValues As Int
Return joNative.RunMethod("SumValues", Array(10, 20))
End Sub
Public Sub SumArray As Float
Dim a() As Float = Array As Float(10.57, 20.53)
Dim b() As Float = Array As Float(50.12, 100.25)
Return joNative.RunMethod("SumArray", Array(a, b))
End Sub
Public Sub CalcArrayList As List
Dim a() As Int = Array As Int(10, 20, 30)
Dim b As Float = 33.35
Dim c() As Double = Array As Double(1.7, 2.3, 3.4)
Return joNative.RunMethod("CalcArrayList", Array(a, b, c))
End Sub
#If Java
import java.util.ArrayList;
public String DemoStringJava () {
return "Hello World!";
}
public String[] DemoArrayJava () {
String[] cars = {"Volvo", "BMW", "Ford", "Mazda"};
return cars;
}
public int SumValues (int a, int b) {
return a + b;
}
public Float SumArray (float[] a, float[] b) {
float total = (a[0] * b[0]) + (a[1] * b[1]);
return total;
}
public ArrayList<Object> CalcArrayList (int[] a, float b, double[] c) {
ArrayList<Object> ResultList = new ArrayList<Object>();
ResultList.add(a[0] + b / c[0]);
ResultList.add(a[1] + b / c[1]);
ResultList.add(a[2] + b / c[2]);
return ResultList;
}
#End If