0% found this document useful (0 votes)
4 views

Section 1 Java Basics

The document covers the basics of Java programming, including variables, data types, operators, conditional statements, loops, arrays, and strings. It highlights Java's strong and static typing, the use of 'var' for type inference, and various control structures such as if-else and switch-case. Additionally, it discusses the immutability of strings and the use of StringBuilder for mutable string operations.

Uploaded by

regmi.gaurav527
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Section 1 Java Basics

The document covers the basics of Java programming, including variables, data types, operators, conditional statements, loops, arrays, and strings. It highlights Java's strong and static typing, the use of 'var' for type inference, and various control structures such as if-else and switch-case. Additionally, it discusses the immutability of strings and the use of StringBuilder for mutable string operations.

Uploaded by

regmi.gaurav527
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Section 1: Java Basics

Variables and Data Types


• Java has strong and static typing.
• Primitive types: int, byte, short, long, float,
double, boolean, char.
• Reference types: Objects and Arrays.
• Use 'var' for type inference (Java 10+).
Operators in Java
• Arithmetic: +, -, *, /, %
• Relational: ==, !=, >, <, >=, <=
• Logical: &&, ||, !
• Assignment and Unary Operators
Conditional Statements
• if, else if, else blocks
• switch-case for multiple condition checks
• Use break to exit switch block
• Enhanced switch (Java 14+)
Loops in Java
• for, while, do-while loops
• Enhanced for loop for arrays/collections
• Use break and continue wisely
Arrays and Strings
• Arrays are fixed-size containers
• String is immutable in Java
• Common String methods: length(), charAt(),
substring(), equals()
• StringBuilder for mutable strings

You might also like