+ 1
Classes in java
Is there anyone here who codes in java using this anacode IDE (on Android). If so, how do you manage to link classes to codes? It doesn't work for me.
5 Respostas
+ 2
Both should be in the src folder and if you also added a package name, then in the subfolder of the package.
+ 1
There is a documentation here how to build an application with multiple files.
http://www.anacodeide.com/article?pagename=build_standalone_java_r1600
You are supposed to create a java project and then you can add new files (classes) in the same folder (normally the src subfolder in the project, and inside it the folder dictated by the name of your custom package.)
+ 1
Tibor Santa yeah. I tried doing that. Didn't work. If I insert the class inside the file that has the main method (like we do in SL), it tells me that it's supposed to be in another file. When I try accessing the class from another file (the process of which I can't understand) it still throws an error.
+ 1
Tibor Santa same folder? The folder where the src folder is or in the src folder?
0
Well I cannot comment on your own code if you don't share it, I can show you how it works for me.
In the Anacode app I created a new project (JavaTest) which has class JavaTest with the main() method.
Then I created a Student.java file in the same folder.
As long as they share the same package and are located in the same folder, they are able to interact even without any import statements.
See these screenshots how my code looks, and it does compile and prints '12'
https://ibb.co/2nWHv6r
https://ibb.co/qDn5Wqn