Professional Documents
Culture Documents
by
S.PARAMASIVAM
JAVA PROGRAMMING
Day 2:
•Type Casting,
•Operators,
JAVA PROGRAMMING
• Type Casting
Type Casting in Java
• In Java, type casting is a method or process that
converts a data type into another data type in both
ways manually and automatically. The automatic
conversion is done by the compiler and manual
conversion performed by the programmer. In this
section, we will discuss type casting and its types with
proper examples.
JAVA PROGRAMMING
• Type Casting
double->float->long->int->short->byte
Post
postfix
increment/decrement
Unary
Pre
prefix
increment/decrement
JAVA PROGRAMMING
•Operators in java
• Unary operators ++ --
int a=10;
int b=a++; // b is assigned the value 10 only
// but a value is 11
int c=15;
int d=c-- ; // d is assigned the value 15 only
// but c value is 14
JAVA PROGRAMMING
•Operators in java
• Unary operators ++ --
int a=10;
int b=++a; // b is assigned the value 11 only
// a also value is 11
int c=15;
int d=--c ; // d is assigned the value 14 only
// c also value is 14
JAVA PROGRAMMING
•Operators in java
Arithmetic operators
• Addition +
• Subtraction -
• Multiplication *
• Division /
• Modulus %
+
JAVA PROGRAMMING
•Operators in java
Arithmetic operators
• Addition + b+c
• Subtraction - a-b
• Multiplication * a*b
• Division / a/b
• Modulus % a%b
JAVA PROGRAMMING
•Operators in java
Shift operators
• Left shift <<
• Right shift >>
• Unsigned right shift >>>
JAVA PROGRAMMING
JAVA PROGRAMMING
•Operators in java
• Unary operators ++ --
• Arithmetic operators + - * / %
• Shift operators << >>
• Relational operators < > <= >= !=
• Bitwise operators &|~ ^
• Logical operators && || !
• Assignment operators += =+
• Ternary operators ?:
JAVA PROGRAMMING
JAVA PROGRAMMING
JAVA PROGRAMMING
JAVA PROGRAMMING
JAVA PROGRAMMING
JAVA PROGRAMMING
JAVA PROGRAMMING
JAVA PROGRAMMING
JAVA PROGRAMMING
JAVA PROGRAMMING