C # differences between namespaces and java packages

Source: Internet
Author: User

C # differences between namespaces and java packages

C # differences between namespaces and java packages

This article mainly introduces the differences between the C # namespace and the java package. It gives a detailed analysis of the similarities and differences between the C # namespace and the java package, which is of great practical value, for more information, see

This article analyzes the differences between the C # namespace and the java package. Share it with you for your reference. The specific analysis is as follows:

Similarities:

1. They are all for reusability-a very important goal in software engineering.

2. Both the namespace in C # And the packages in java belong to the access permission control mechanism.

Differences:

1. the C # namespace is a logical structure that allows the physical storage location of the class files in the organization to be different from the logical structure, the physical structure of class files in Java must be consistent with the logical structure.

2. the Java package itself does not have the sub-package concept. All packages are in parallel, and no one includes them. For example, there is absolutely no relationship between packages and sub-packages between org. dominoo. action. asl and org. dominoo. action. asl. They are independent packages and each has its own class/interface set. In a java file of org. dominoo. action. asl, If You Want To reference a class/interface in org. dominoo. action, you must import org. dominoo. action.

C ++/C # does not use the namespace solution. A namespace can have its own sub-namespace, the package of C ++/C # may have a relationship with the sub-package.

3. Use the import Statement in Java and the using namespace statement in C.

I hope this article will help you with C # programming.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.