0
Is it possible to create an object that would be constructed from the class it's was calling from, or it is a loop.
4 Antworten
+ 1
Are you describing instanciation or is there something I didn't get?
MyClass myObj = new MyClass();
+ 1
Yes you can, and yes it has the potential to create an infinite loop. Common question is if it's done in the main method what happens, in such case, it doesn't create an infinite loop since main only gets called once as an instance since it's static.
0
lookup recursion.
0
all examples with recursion are with method recursion, and what if:
class MyClass {
...
MyClass myObj = new MyClass();
...
}