In the class Myclass the class Help is loaded as an object but then it’s loaded again in the Help class itself. Isn’t the Help class loaded twice? What is the reason for doing so?
For example:
public class Myclass {
int i;
Object help;
public Myclass() {
help = new Help(); /// help class loaded
}
private Object doSomething(int h) {
Help.getHelp(h);
}
}
Help class:
public class Help(){
Object returnhelp;
int h;
public Help() {
int h=3;
}
public Help getHelp(int y) {
return new Help(y); ///// Help class loaded again ????
}
private add(int y) {
h=+y;
return h;
}
}
The class is not loaded twice, but twice instantiated as an object.
Here is the high level view from the Java tutorial.