How do I use import statement and packages in the code playground? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How do I use import statement and packages in the code playground?

Packages

21st Mar 2017, 10:13 PM
Ngaka Ya Meropa
Ngaka Ya Meropa - avatar
3 Answers
+ 13
You use imports like you are supposed to do in Java. But code playground doesn't support every package. E.g. gui apis cannot be imported/run. Example (all classes of utility package): import java.util.*;
22nd Mar 2017, 5:03 AM
Tashi N
Tashi N - avatar
+ 12
Unfortunately not. You can write different classes, but all in one file -.- When you run your code in code playground it is actually sent to the SoloLearn servers, executed there and the output is sent back. So you don't have a chance to import your own packages/classes.
22nd Mar 2017, 5:13 AM
Tashi N
Tashi N - avatar
+ 1
Thank you Tashi. Can I create my own package on playground ?
22nd Mar 2017, 5:11 AM
Ngaka Ya Meropa
Ngaka Ya Meropa - avatar