Analysis of the difference between C # namespaces and Java Packages

Source: Internet
Author: User

analysis of the difference between C # namespaces and Java Packages

This article mainly introduced the C # namespace and Java package differences, more detailed analysis of the C # namespace and Java package of the same point and different points, very practical value, the need for friends can refer to the

This article analyzes the difference between the C # namespace and the Java package. Share to everyone for your reference. The specific analysis is as follows:

Same point:

1, all is for the reusability (reusebility)--software engineering in a very important goal.

2, C # inside the namespace and Java packages are the control mechanism of access rights.

Different points:

1. The C # namespace is just a logical structure that allows the physical location of the organization's class files to be stored in an inconsistent logical structure, while the physical structure of the class files in Java must conform to the logical structure.

2, the Java package itself does not have the concept of a child package, all package are tied to the relationship, no one who contains the problem. For example: There is absolutely no relationship between Org.dominoo.action and ORG.DOMINOO.ACTION.ASL between the packet and the child package. They are separate packages, each with their own set of class/interface. In a Java file in ORG.DOMINOO.ACTION.ASL, you must import org.dominoo.action if you want to refer to a class/interface in org.dominoo.action.

c++/c# namespace scheme is not, a namespace can have its own sub-namespace, we may wish to namespace also known as package, then c++/c# between the package can be the relationship between the packet and the child package.

3, the import statement is used in Java and the using namespace statement is used in C #.

I hope this article will help you with the C # program.

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.