What is the difference (in terms of use) between namespaces in C# and packages in Java?
A namespace is just like a new folder, all subfolders are sub-namespaces. If we consider a namespace as a function like we have a namespace advertising under marketing namespace then we use marketing.advertising.adsclass.adsmethod. Very easy to solve a problem. Java has same method via package but complex for new comers.
In C#
''' namespace marketing{
class admissions{
int admissions_method(){
}
}
namespace advertising{
class advertisement{
void ad_in_newspaper( int no_of_lines){
}
void ad_on_tv(int seconds){
}
}
}
To use in client class
using marketing;
using marketing.advertising;
''' In java you use same method. You pack multiple classes in one package and use it many times. It increases uniqueness. You write once and use many times. Related classes in one package. No need to code many times.