Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java package vs c# assemblies [duplicate]

Possible Duplicate:
Is a Java package the equivalent of a .Net assembly?

I was comparing the access modifiers in Java and C#.

In java the default access allows access to the class being modified to everything in the package that the class is in. In C# the internal access modifier allows access to the class being modified to everything in the assembly that the class is in.

Are Java packages the same as C# assemblies, if not what is the difference.

like image 726
Zzz Avatar asked Nov 08 '12 17:11

Zzz


2 Answers

No they are not same. As also mentioned in the Thread. The best comparison would be with a Java ARchive (Jar) file. Java uses packages to control the namespace, and is very similar to C#'s Namespaces.

like image 191
Rahul Tripathi Avatar answered Oct 07 '22 08:10

Rahul Tripathi


Its better to think of a C# assembly as a sealed jar or an OSGI package. A Java package is closer to a C# namespace, although none of these concepts map across the two languages perfectly.

like image 24
Dilum Ranatunga Avatar answered Oct 07 '22 07:10

Dilum Ranatunga