# Structure of a Java program

### Explanation:

1) Packages - can consist of a set of classes.

2) Classes - contains a set of similar types of methods. A program can contain multiple classes. However, at least one of them should contain the main function but there are exceptions too.

3) Methods - are actually functions present inside classes, works exactly like functions which is a piece of code that can be used multiple times without writing them again and again. Implementing the DRY(Do Not Repeat) principle.

4) Properties/attributes - are simply variables associated with the class, which can be accessed or restricted in or out of a class depending on the access modifiers used.

5) object/instance of a class - a copy of the class.

### Example:

Say you have a book with all the details on household workers consider it as a **package**.

Now there are different types of workers which can be an electrician, plumber, caretaker, babysitter and so on which can be considered **classes.**

These classes will contain all the details related to workers like his/her name, number and so on which can be considered **attributes or properties**.

Moving on, these classes will also contain details regarding how to contact them or schedule a time for repairing with them. These contents can be stored in the form of **methods**.

Finally, when it comes to accessing them we don't need to use the original one all we need is a copy and that copy is what we refer to as **objects**.

### Some tips for naming conventions:

In the case of <mark>classes</mark>, follow the <mark>pascal case convention</mark> that is first letter must be capital then small and repeat the same rule for succeeding words (if the name contains more than 1 word). Eg:- PascalCaseConvention

In the case of <mark>packages, methods, attributes and objects</mark>, follow the <mark>camel case convention</mark> that is the first letter small and the succeeding words' first letter must be capitalized (if the name contains more than 1 word). Eg:- camelCaseConvention
