5

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.

Community
  • 1
  • 1
Zzz
  • 2,927
  • 5
  • 36
  • 58

2 Answers2

4

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.

Community
  • 1
  • 1
Rahul Tripathi
  • 168,305
  • 31
  • 280
  • 331
2

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.

Dilum Ranatunga
  • 13,254
  • 3
  • 41
  • 52