0% found this document useful (0 votes)
5 views1 page

Java Notes

The document explains how Java works, detailing the process from English code to machine-readable output through a compiler and virtual machine. It covers variables, data types, memory management, string comparison, logical operators, conditional statements, nested ifs, and the ternary operator. Each concept is illustrated with examples to clarify their usage in Java programming.

Uploaded by

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

Java Notes

The document explains how Java works, detailing the process from English code to machine-readable output through a compiler and virtual machine. It covers variables, data types, memory management, string comparison, logical operators, conditional statements, nested ifs, and the ternary operator. Each concept is illustrated with examples to clarify their usage in Java programming.

Uploaded by

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

How java works:

English code -> java compiler -> byte code -> java virtual machine -> machine
readable code -> output execute.

Variables and Data Types:


1.Variable = stores datas
Example:
A = 10
//here A is a variable

2.Data Types:
(1) Byte data type.
(2) Boolean data type.
(3) Int data type.
(4) Short data type.
(5) Char data type.
(6) Double data type.
(7) Float data type.
(8) Long data type.
Example:
int A = 10
//here int is a data type

3.How memory works

memory city = stack + heap


| / \
int a=10 object string pool
|
name ="john"
4.Comparing two strings
syntax:
a1 = abc;
a2 = xyz;
if(a1.equals(a2));

5.Logical operators
1.&&(AND)
2.||(OR)
3.dividing(module %(num%2 == 0))

6.else if :
In normal (if else) condition the if condition is false it will automatically
print the else condition,
but in (else if) condition if the (if statement) is false it will check the (else
if) statement it wiil
not directly print the else statement and once the statement becomes true the
program will be stopped.

7.Nested if :
In (nested if) condition inside a (if statement)we can add another (if
statement).

8.Ternary operator:
Syntax:
variable = (condition)?"value if true" : "value if false"

You might also like