Following is the code snipped in groovy that demonstrate the conversion Groovy Array type to Java Array Type.
Code for Groovy
def param=[]
param+="paramater 1"
param+="paramater 2"
param+="paramater 3"
param+="paramater 4"
def stringArgForJava = (String[])params
Test.callJavaClass(stringArgForJava) //static method
The sample java class is as follow;
class Test
{
public static void callJavaClass(String[] arg)
{
for(int i=0;i
System.out.println("params "+i ":" +params[i]);
}
}
}
Tuesday, November 3, 2009
Converting Groovy Array type to Java Array Type
Subscribe to:
Post Comments (Atom)
2 comments:
I just started taking a class in algorithm design. It teaches C++ first and then JAVA. I will certainly bookmark this site so that when I do become proficient, I will come back here for information. THANKS!
nice script thanks for sharing.
Post a Comment
I love to entertain onymous user Comment !