Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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.
0683p000009MDLy.jpg 0683p000009MDQu.jpg
Labels (3)
3 Replies
Anonymous
Not applicable
Author

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
Anonymous
Not applicable
Author

hi sabrina
thank you very much for your reply.
and now its working fine
regards
Jeelesh
Anonymous
Not applicable
Author

Hi,
Welcome. and thanks for your feedback!
Best regards
Sabrina