What is the difference (in terms of use) between namespaces in C# and packages in Java?
Share
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.
From: http://www.javacamp.org/javavscsharp/namespace.html
Java
Packages are used to organize files or public types to avoid type conflicts. Package constructs can be mapped to a file system.
may be replaced:
There is no alias for packages. You have to use import statement or fully-qualified name to mention the specific type.
or
Another source file:
Package cannot be nested. One source file can only have one package statement.
C#
Namespaces are used to organize programs, both as an “internal” organization system for a program, and as an “external” organization system.
may be replaced:
Alternatively, one could specify an alias for the the namespace, eg
and then refer to the class with
or