Java Concepts Notes
Java Concepts Notes
User-Defined Exceptions:
------------------------
You can create your own exception by extending the Exception class.
Example:
super(message);
throw vs throws:
----------------
Numerical Exception:
--------------------
try {
int a = 10 / 0; // ArithmeticException
} catch (ArithmeticException e) {
}
2. Threading
Concurrent vs Parallel:
------------------------
Runnable Interface:
-------------------
System.out.println("Runnable thread");
Thread Class:
-------------
System.out.println("Thread class");
3. Java IO
File Reading:
-------------
File Writing:
-------------
4. Java Swing
Example:
--------
f.add(b);
5. Generics
Generic Class:
--------------
class Box<T> {
T value;
Generic Method:
---------------
<T> void display(T value) {
System.out.println(value);
6. Collections
List:
-----
Set:
----
Map:
----
7. Wrapper Class
Wrapper Example:
----------------
int a = 10;
Wrapped Collection:
-------------------
Collections.unmodifiableList(original);
8. Features of OOP
- Encapsulation
- Abstraction
- Inheritance
- Polymorphism
- Modularity
- Message Passing