Import problem | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Import problem

I want to write method and main in diferent file (same folder) but i can't import method to main file. Is there any problems? Do i have to create package to keep them?

11th Feb 2019, 4:26 PM
Ngọc Đoàn
Ngọc Đoàn - avatar
1 Answer
+ 2
I will assume you put the method in its own class and then created a new instance of said class in the main. If you did the above, then yes, all the files that make up your program should be in the SAME package.
1st Mar 2019, 11:03 AM
Marcia
Marcia - avatar