Tuesday, November 3, 2009

Converting Groovy Array type to Java Array Type

Facebook

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]);
}

}
}







2 comments:

online tech support said...

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!

subash said...

nice script thanks for sharing.

Post a Comment

I love to entertain onymous user Comment !

Pages

 ©mytechtoday.com 2006-2010

 ©Mytechtoday.com, Learning from Experiences !

TOP