Java Notes
Java Notes
Arithmetic operators
Assignment operators
Comparison operators
Logical operators
Bitwise operators
Arithmetic Operators
Assignment Operators
Comparison Operators
Logical Operators
Logical operators are used to determine the logic between variables or values:
Example - &&,!<
Array
one-dimensional
A one-dimensional array is essentially a list of items that are all of the same type. To
create one, you first need to declare it by specifying the type of items it will hold and
give it a name. Here's a short
Compilation: Java source code (in .java files) is translated into bytecode using the
Java compiler (javac).
Interpretation: When running a Java program, the Java Virtual Machine (JVM)
interprets bytecode and translates it into machine code specific to the host system (JIT
compilation).
It includes essential tools like the Java compiler (javac) for code compilation.
JDK also contains the Java Runtime Environment (JRE), which is needed to run Java
applications on your computer.
Java's motto: "Write once, run anywhere" means code can run on any platform with a
compatible JVM.
Features of Java
Simple
Secure
Portable
Object-oriented
Robust
Multithreaded
Architecture-neutral
Interpreted
High performance
Distributed
Dynamic
Java Data Types are used to classify and store different types of data in Java
programs. Here are the basic data types in Java:
Primitive Data Types: A primitive data type specifies the size and type of variable
values, and it has no additional methods.
1. Selection Statements:
if: Makes decisions based on a condition. If the condition is true, a block of code executes.
switch: Used for multiple conditional branches. It selects a code block to execute based on a
specific value.
do-while: Repeats a block of code at least once and continues while a condition is true.
3. Jump Statements:
break: Exits a loop or switch statement prematurely.
continue: Skips the current iteration of a loop and continues with the next iteration.