Core Java Topics You Should Master
1. Basic Syntax and Data Types
Variables, literals, and keywords
Primitive vs reference types
Type casting and wrapper classes
2. Control Flow Statements
if, else, switch
Loops: for, while, do-while
break, continue, and labels
3. Object-Oriented Programming (OOP)
Encapsulation: using access modifiers
Inheritance: extends, method overriding
Polymorphism: compile-time vs runtime
Abstraction: abstract classes and interfaces
4. Exception Handling
try, catch, finally, throw, throws
Checked vs unchecked exceptions
Custom exceptions
5. Java Collections Framework
List, Set, Map, Queue
ArrayList vs LinkedList
HashMap vs TreeMap
Iterators and enhanced for-loop
6. Multithreading and Concurrency
Thread creation: Thread vs Runnable
Synchronization and locks
wait(), notify(), notifyAll()
Executor framework
7. Java 8+ Features
Lambda expressions
Functional interfaces (Predicate, Function, etc.)
Streams API
Method references and Optional
8. Memory Management
Stack vs heap
Garbage collection
finalize() method (deprecated in newer versions)
9. Access Modifiers and Keywords
public, private, protected, default
static, final, this, super, transient, volatile
10. File I/O and Serialization
Reading/writing files using FileReader, BufferedReader, etc.
Object serialization with Serializable interface
String Methods
length() – Returns the number of characters in the string.
charAt(int index) – Returns the character at the specified index.
substring(int begin, int end) – Extracts a portion of the string.
equals(String another) – Compares two strings for exact match.
equalsIgnoreCase(String another) – Compares two strings ignoring case.
compareTo(String another) – Lexicographically compares two strings.
contains(CharSequence seq) – Checks if the string contains a sequence.
indexOf(String str) – Returns the index of the first occurrence.
lastIndexOf(String str) – Returns the index of the last occurrence.
startsWith(String prefix) – Checks if string starts with prefix.
endsWith(String suffix) – Checks if string ends with suffix.
toLowerCase() / toUpperCase() – Converts case.
trim() – Removes leading/trailing whitespace.
replace(char old, char new) – Replaces characters.
split(String regex) – Splits string into array using regex.
📦 Array Methods (java.util.Arrays)
sort(array) – Sorts the array.
toString(array) – Converts array to string.
copyOf(array, length) – Copies array to new length.
copyOfRange(array, start, end) – Copies a range.
equals(arr1, arr2) – Compares arrays.
fill(array, value) – Fills array with value.
binarySearch(array, key) – Searches sorted array.
stream(array) – Converts array to Stream.
asList(array) – Converts array to List.
📋 ArrayList Methods
add(element) / add(index, element) – Adds element.
get(index) – Retrieves element.
set(index, element) – Updates element.
remove(index) / remove(object) – Removes element.
size() – Returns size.
isEmpty() – Checks if empty.
clear() – Removes all elements.
contains(object) – Checks presence.
indexOf(object) / lastIndexOf(object) – Finds index.
subList(start, end) – Returns sublist.
toArray() – Converts to array.
sort(comparator) – Sorts list.
forEach(action) – Iterates with lambda.
🧠 Math Methods (java.lang.Math)
abs(x) – Absolute value.
max(x, y) / min(x, y) – Max/min.
pow(x, y) – Power.
sqrt(x) – Square root.
round(x) – Rounds value.
ceil(x) / floor(x) – Rounds up/down.
random() – Returns random double.
log(x) / exp(x) – Logarithmic/exponential.
sin(x) / cos(x) / tan(x) – Trigonometric functions.
🧵 Thread Methods
start() – Starts thread.
run() – Defines thread logic.
sleep(ms) – Pauses thread.
join() – Waits for thread to finish.
interrupt() – Interrupts thread.
isAlive() – Checks if running.
yield() – Suggests thread scheduler to switch.
📚 Object Class Methods
equals(obj) – Compares objects.
hashCode() – Returns hash code.
toString() – String representation.
getClass() – Returns runtime class.
clone() – Creates copy.
finalize() – Called before garbage collection.
🔐 System Class Methods
System.out.println() – Prints output.
System.currentTimeMillis() – Time in ms.
System.exit(status) – Terminates JVM.
System.gc() – Suggests garbage collection.
System.getenv() – Gets environment variables.
System.getProperty() – Gets system properties.
🧾 File I/O Methods (java.io.*)
read() – Reads byte/char.
write() – Writes byte/char.
close() – Closes stream.
flush() – Flushes stream.
available() – Bytes available to read.
mark() / reset() – Marks and resets stream position.