Is it possible to write a method that is available at package-level? Assume foo is a package:
long version = foo.getPackageVersion();
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.
No, it is not. Methods can only be defined on classes. Nowhere else.
A package is not physical, it can’t serve as a container for byte code. Packages are nothing but namespaces for classes, enums and interfaces.