I want to declare a factory class with some methods and attributes that can be used like this:
ClassFactory myObj = MyObj("Class1").method1("input 2");
It seems that this is not a valid JAVA statement because JAVA is fully Object oriented and don’t let to declare global function. But if there are a mechanism that let define function without name we can define it as a static function and use it as mentioned above.
Is there any way to implement that in JAVA in that manner or any other way?