in php you can declare a function in a global scope with function.
is this not possible in java? looks like every function is in a class as a method. so everything is OOP in java? no procedural code?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The closest thing you can have to a “free-floating” function is a static function, which you can call as qualified with the class name, e.g.
… elsewhere
You can add a bit of syntactic sugar to this to make it look like what you’re thinking of:
… elsewhere