Java project structure explained for newbies?

前端 未结 10 1064
攒了一身酷
攒了一身酷 2020-12-07 13:15

I come from a .NET background and am completely new to Java and am trying to get my head around the Java project structure.

My typical .NET solution structure conta

10条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-07 14:02

    Okay so in java you have three different types of access to a classes member functions and variables

    public protected package-private and private

    All classes in the same package can see each others public, protected, and package-private elements.

    Packages are not hierarchical in the system. Usually they are organized in a hierarchical way, but as far as runtime is concerned com.example.widgets is a completely different package from com.example.widgets.cogs

    Packages are arranged as directories, which helps keep things organized: your file structure is always similar to your package structure.

    They are planning on adding a module system to Java in JDK7 (called Project Jigsaw) and there is an existing module system called OSGi. These module systems will/can give you a lot more flexibility and power then the simple package system.

    Also, package names are usually all lower case. :)

提交回复
热议问题