+ 4

How to create a Java Program with two classes in the playground

I have a Test-class that creates different instances of my OBJECT-class, but if I run the program it cant find the OBJECT-class. Besides: I have to put the classes separated because of an Interface I'm using.

31st Mar 2017, 12:36 PM
Johann Leis
Johann Leis - avatar
3 Answers
+ 12
You have to put them in one file at playground, like fghhj said, before he edited his post :D
31st Mar 2017, 4:11 PM
Tashi N
Tashi N - avatar
+ 9
You mean in playground or ide? Ide: You have to import your class to the class where it is used, if it is stored in another package: import mypackagePath.myClass; Make sure your .java file is named like your class, e.g. myClass.java
31st Mar 2017, 1:16 PM
Tashi N
Tashi N - avatar
- 2
oh
31st Mar 2017, 4:11 PM
fghhj
fghhj - avatar