I have a doubt. Be the following Java Class code:
public class myClass{
public myClass myMethod(){
...
}
...
}
1) How could myMethod return type be the auto-class? It is no logican sense for me. 2) What does it mean?
Thanks :)
There seems to be some spelling mistakes in questions, Seems like you are asking how can it is possible that method return type is same as class.
The Answer is: this is because Return type is just used for specifying datatype and class is Data type like Integer String.
This is example of factory design pattern
moving back to your question, myMethod return myClass means it return an Object of myClass
We can perform any operation on return value which you can perform on myClass object