oop - Global function or function with no name java for factory pattern -


i want declare factory class methods , attributes can used this:

classfactory myobj = myobj("class1").method1("input 2"); 

it seems not valid java statement because java object oriented , don't let declare global function. if there mechanism let define function without name can define static function , use mentioned above.

is there way implement in java in manner or other way?

you can create public static method in class , can use globally. instance method public static boolean doeswork() { return true; } in public class named globalclass can accessed globalclass.doeswork() , return true.


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

c# - Exception when attempting to modify Dictionary -