Java Topics - Simple Explanations
What is Java?
Java is a high-level, object-oriented programming language used to build applications. It is
platform-independent, meaning it can run on any system with a Java Virtual Machine (JVM).
Programming Language
A way to communicate instructions to a computer to perform specific tasks.
Low Level Language
Languages close to machine language like Assembly. Harder for humans to read.
High Level Language
Languages like Java, Python, and C++ that are easy for humans to read and write.
Translators
Tools that convert code from one language to another.
Compiler
A program that translates the entire code at once before execution.
Interpreter
A program that translates and runs code line by line.
Java Process
Write code → Compile with javac → Run with java command on JVM.
Basic Syntax for Java Program
Every Java program has a class, main method, and statements inside curly braces.
What is Data?
Data is information or values used and processed by a program.
Data Type
The kind of data a variable can hold, like numbers or text.
Primitive Data Types
Basic types like int, char, boolean, float.
Non Primitive Data Types
Objects like Arrays, Strings, and Classes.
Commonly Used Data Types
Integer, Decimal, Single Character, String, Boolean.
Operations
Actions performed on data like printing or storing.
Printing Operation
Displaying information on the screen using System.out.println().
Storage Operation
Saving data in variables for later use.
Keywords
Reserved words in Java with special meanings like int, if, class.
Identifiers
Names for variables, methods, classes, etc.
Naming Conventions
Rules for naming variables and classes.
Pascal Casing
First letter of every word is capital (Example: StudentName).
Camel Casing
First word starts with lowercase, other words start with uppercase (Example:
studentName).
Variable
A container that holds data values.
Operator
A symbol that performs operations on variables and values.
Operand
The values or variables on which operators work.
Types of Operators
Categories of operators like arithmetic, relational, logical, etc.
ASCII Values
Numerical values for characters (A=65, a=97).
List of Operators
Includes Arithmetic, Relational, Logical, Assignment, Conditional, Increment/Decrement,
Combinational, and Bitwise Operators.
Control Flow Statements
Decide the flow of a program with conditions and loops.
Conditional Statements
Statements like if, if-else, switch to make decisions.
Looping Statements
Statements like for, while, do-while to repeat actions.
Standard Programs
Common examples like Spy number, Perfect number, Prime number, Palindrome,
Armstrong number, etc.
Method
A block of code that performs a task.
Pre-defined Methods
Built-in Java methods like length(), println().
User-defined Methods
Methods created by the programmer.
Stack Overflow Error
Error when the program uses too much memory in the call stack, often caused by infinite
recursion.
Method Recursion
A method calling itself to solve a problem.