Cannot resolve to a type in tJava component

One Star

Cannot resolve to a type in tJava component

hi,
I was trying to declare a ArrayList in tJava component and while executing the the job an error came across "ArrayList cannot be resolved to a type". All packages required were imported.
Below mentioned is the simple java code which i tried in tJava component.
ArrayList<String> master=new ArrayList<String>();
int i=10;
try
{
while (i>0)
{
master.add("a"+i);
System.out.println(master.get(i));
i-=1;
}
}
catch(Exception e)
{
e.printStackTrace();
}

Can any one explain whether declaration of primitive datatypes are only allowed in tJava component and why not the non primitive ones. And to declare and use those datatypes where i should declare those types.
Moderator

Re: Cannot resolve to a type in tJava component

Hi,
It is a compile error, you don't import its package, should be:
java.util.ArrayList<String> master=new 
java.util.ArrayList<String>();

Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: Cannot resolve to a type in tJava component

hi sabrina
thank you very much for your reply.
and now its working fine
regards
Jeelesh
Moderator

Re: Cannot resolve to a type in tJava component

Hi,
Welcome. and thanks for your feedback!
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.