# OOP in Java

## Access Modifiers in Java

1. Default – No keyword required
2. Private
3. Protected
4. Public

Source: [Access Modifiers in Java ](https://www.geeksforgeeks.org/access-modifiers-java/)

![](https://1611446478-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M63nDeIUEfibnkE8C6W%2Fsync%2F8671043f4f4da40ac20c4505bf551fcfccc9a03a.png?generation=1588144786063726\&alt=media)

## **Non-access modifiers**

* [static](https://www.geeksforgeeks.org/static-keyword-java/)
* [final](https://www.geeksforgeeks.org/final-keyword-java/)
  * variable - to create constant variables
  * method - prevent method overriding
  * class - prevent inheritance
* abstract
* [synchronized](https://www.geeksforgeeks.org/synchronized-in-java/)
  * <http://tutorials.jenkov.com/java-concurrency/synchronized.html>
  *
* [transient](https://www.geeksforgeeks.org/transient-keyword-java/)
* [volatile](https://www.geeksforgeeks.org/volatile-keyword-in-java/)
* native

## Generics

### [Type Parameter Naming Conventions](https://docs.oracle.com/javase/tutorial/java/generics/types.html)

By convention, type parameter names are single, uppercase letters. This stands in sharp contrast to the variable [naming](https://docs.oracle.com/javase/tutorial/java/nutsandbolts/variables.html#naming) conventions that you already know about, and with good reason: Without this convention, it would be difficult to tell the difference between a type variable and an ordinary class or interface name.

The most commonly used type parameter names are:

* E - Element (used extensively by the Java Collections Framework)
* K - Key
* N - Number
* T - Type
* V - Value
* S,U,V etc. - 2nd, 3rd, 4th types
