Non-class functions in Java
问题 I'm mostly a c/C++/objective-C programmer, presently working in Java on an android application. My question is simple: I want a utility function, preferably not associated with any class that I can invoke from anywhere in my project (#include of some sort necessary?). I know I can make a public static function of a class and invoke it as Class.someFunction(); . I would like to just have someFunction(); I'm not sure if this is possible in java, or what the syntax for it is. 回答1: You can