Notes Part 3
Notes Part 3
Character Set
A set of graphical and textual symbol each of which is mapped to a positive integer.
A character preceded by \ (backslash) is known as escape sequence and hold a special meaning to the compiler.
Java has a total of 8 escape sequences.
Questions:-
Output when :-
\\\"
\a
Data Types
Integer float double Char Boolean Note: they are referential data type i.e
instead of storing the value of the literal
they store the location of the literal.
Write a program(WAP) to assign two numbers and then calculate their sum,difference,product,division in sepeate variables and then print
them .
datatype variable=value;
Each line is terminated by a semicolon
Name of the class should start with a alphabet, can be folllowed by number
Assignment vs declaration.
1.Arithmetic Operators
2.Assingment Operators
3.Unary Operators They also have a special type called as short-hand operators
4.Comparison/Relational Operators
5.Logical Operators
6.Bitwise Operators
7.Miscleneous Operators
1.Arithemetic Operators
4.Comparison/Relational Operators
3.Unary operators
Used to determine logic between variable/values. Only conditional operator that takes 3 operands.
Its and replacement for if-then-else
Symbol--> ? :
Egs:-
num1 = 10;
num2 = 20;
res=(num1>num2) ? (num1+num2):(num1-num2)
Since num1<num2,
the second operation is performed
res = num1-num2 = -10
Certain operators have higher precedence than others and therefore precedence of operator decides how an expression
should be evaluated.
ICSE 2015