Java Basics Notes
What is Java?
Java is a platform-independent, object-oriented programming language. Code is compiled to
bytecode and runs on the JVM.
JDK, JRE, JVM
JDK: Development tools + JRE. JRE: JVM + libraries. JVM executes bytecode.
Program Structure
class, main() method, statements, comments.
Variables
Primitive: byte, short, int, long, float, double, char, boolean. Non-primitive: String, Arrays, Classes.
Operators
Arithmetic, Relational, Logical, Assignment, Unary, Ternary.
Control Statements
if, if-else, switch, for, while, do-while, break, continue.
Methods
Syntax, parameters, return type, method overloading.
Arrays
Single and multidimensional arrays, traversal with loops.
Strings
String creation, common methods: length(), charAt(), substring(), equals(), toUpperCase().
OOP Intro
Class, Object, Constructor, Encapsulation, Inheritance, Polymorphism, Abstraction.
Exception Basics
try, catch, finally, throw, throws.
Important Tips
Java is case-sensitive. One public class per file. main(): public static void main(String[] args).