JAVA
JAVA
## 1. Java Fundamentals
- Bytecode compilation
- Class structure
- Package organization
1. **Primitive Types**
```java
boolean // true/false
```
2. **Reference Types**
- Objects
- Arrays
- Strings
- Classes
- Interfaces
### 1.3 Variables & Constants
- Instance variables
- Local variables
- Final variables
## 2. Object-Oriented Programming
1. **Class Components**
```java
class Example {
// Fields
// Constructor
public Example() {}
// Methods
// Nested classes
class Inner {}
```
2. **Access Modifiers**
- public
- private
- protected
- package-private (default)
1. **Types**
- Single inheritance
- Hierarchical inheritance
2. **Keywords**
- extends
- implements
- super
- this
1. **Method Overloading**
- Compile-time polymorphism
2. **Method Overriding**
- Runtime polymorphism
1. **Abstract Classes**
```java
void concreteMethod() {}
```
2. **Interfaces**
```java
interface Example {
void method();
```
- Data hiding
- Getter/setter methods
- Access control
- Package organization
## 3. Exception Handling
1. **Hierarchy**
- Throwable
- Error
- Exception
- RuntimeException
- Checked Exception
2. **Custom Exceptions**
```java
super(message);
}
```
```java
try {
} catch (Exception e) {
// Exception handling
} finally {
// Always executed
// Try-with-resources
```
## 4. Collections Framework
- Collection
- List
- Set
- Queue
- Map
1. **Lists**
- ArrayList
- LinkedList
- Vector
- Stack
2. **Sets**
- HashSet
- LinkedHashSet
- TreeSet
3. **Maps**
- HashMap
- LinkedHashMap
- TreeMap
- Hashtable
- Sorting
- Searching
- Shuffling
- Manipulation
## 5. Generics
```java
private T value;
this.value = value;
}
public T getValue() {
return value;
```
```java
```
- Unbounded (`<?>`)
## 6. Multithreading
1. **Extending Thread**
```java
// Thread code
```
2. **Implementing Runnable**
```java
// Thread code
```
1. **Synchronized Methods**
```java
```
2. **Synchronized Blocks**
```java
synchronized(object) {
// Synchronized code
```
- wait()
- notify()
- notifyAll()
- join()
## 7. I/O Operations
- InputStream
- OutputStream
2. **Character Streams**
- Reader
- Writer
```java
// File operations
file.createNewFile();
file.delete();
// NIO.2
Files.createFile(path);
Files.delete(path);
```
## 8. Advanced Features
```java
// Lambda syntax
// Example
```java
numbers.stream()
.filter(n -> n % 2 == 0)
.map(n -> n * 2)
.collect(Collectors.toList());
```
```java
optional.ifPresent(System.out::println);
```
```java
module com.example {
requires java.base;
exports com.example.api;
```
- Heap
- Stack
- Method Area
- PC Registers
1. **Generations**
- Young Generation
- Old Generation
- Metaspace
2. **GC Algorithms**
- Serial GC
- Parallel GC
- CMS
- G1 GC
- ZGC
- Memory management
- Threading considerations
- Resource handling
- Caching strategies
### 10.3 Security
- Input validation
- Access control
- Secure communication
- Cryptography usage