Is a Java package the equivalent of a .Net assembly?

后端 未结 5 1012
一个人的身影
一个人的身影 2020-12-04 20:01

I am a .Net developer starting Java development for Android and would like to know if it\'s correct to think of Java packages like .Net assemblies.

5条回答
  •  难免孤独
    2020-12-04 20:29

    A package in Java usually means just a namespaces for classes and interfaces, which in reality means a specific directory structure. Sometimes a .jar file is also referred to as a package. This is probably the closest you get to an assembly. A .jar file can also contain other data like images, or basically an kind of file since it is just a zip again with some specific content structure.

    In any case: Usually when you read "package" in relation to "Java", some kind of namespaces (via folder structure, e.g.: com.mycompany.myproject) is meant. It doesn't help that some build tools refer to the process of building .jar file as "packaging" ;-)

提交回复
热议问题