+ 1
I cant seem to wrap my head around these or how they work along side each other.
arguments calling methods in main class public class private class plus is there any apps i can download to run java with simple image based apps on android ? i have a laptop but when i upgraded to windows 10 i lost the my cursor and never figured out how to get it back. kind of 2 questions in one but im mostly intrested in what the java stuff means in simple terms
2 ответов
+ 3
Regarding your questions about the Java stuff:
arguments are what you are passing to the parameters of a method.
Here I'm just calling a method:
myMethod(5, "cool");
5 and cool are the arguments.
calling methods in main class is kinda self explanatory if you know what those words mean.
Main class just refers to the class with the main method.
Calling a method is well, calling a method :@.
Example/
myMethod();
I'm making the program change it's course and run whatever code is inside that method. I recommend looking back at the sololearn course if that's confusing.
public and private are protection modifiers.
Public will allow the member to be accessed from any class.
private will allow the member to only be accessed from within that class.
So, now referring to classes.
A public class is just a class that can be accessed from any class.
A private class cannot be accessed anywhere, except in it's own class.
So since the private class cannot be called anywhere it would really be useless unless the class has some starting method to auto-run.
For example in Unity if the class extends mono-behaviour it can be a private class as it will still have a running Update method. Although, I'm not even sure if this would work since the Update method might not be able to be called.
Java does not allow regular- private classes, since there may not be a way to get it to run on its own (not 100% sure). Although, Inner classes I suppose can be private.
0
thank you i think i understand this better now