Introduction To J
Introduction To J
to JAVA
DR. RAJASHRI JOSHI
PROGRAMMING BASICS
Identifiers
Datatypes
Operators
Control statements
Loop
Arrays
Inheritance in JAVA
Multilevel Hierarchy
Method overriding
Abstract classes
Final classes
Identifiers
Identifiers in Java are symbolic names used for identification.
They can be a class name, variable name, method name, package name, constant name, and more.
Rules
A valid identifier must have characters [A-Z] or [a-z] or numbers [0-9], and underscore (_) or a dollar sign
($).
Must start with character.
An identifier should be of length 4-15 letters only. However, there is no limit on its length. But, it is good
to follow the standard conventions.
Do not use the Java reserved keywords as an identifier
An identifier should not be any query language keywords such as SELECT, FROM, COUNT etc
Reserved words
Reserved keywords are predefined words, which are reserved for any functionality or meaning.
There are 53 reserved words in Java.
{ }
int a = 10;
short s = 2;
byte b = 6;
long l = 125362133223l;
MEMBER VARIBLES;
MEMBER FUNCTIONS()
object creation
} }
System.out.println("Hello");
* Multiplication - Multiplies values on either side of the operator A * B will give 200
/ Division - Divides left hand operand by right hand operand B / A will give 2
Operator Meaning
< Is less than
<= Is less than or equal to
> Is greater than
>= Is greater than or equal to
== Is equal to
!= Is not equal to
Logical operators
Operator Meaning
&& logical AND
|| logical OR
! logical NOT
Assignment operator
v op= exp;
a=a+1 a +=1
a=a–1 a-=1
a = a*(n+1) a *= n+1
a = a/(n+1) a /= n+1
a = a%b a %= b
INCREMENT AND
DECREMENT OPERATORS conditional OPERATORS
++ or --
expl? exp2: exp3
if (a > b)
m=5 x = a;
else
x = b;
y=m++
or X=(a>b)?a:b
y=++m
BITWISE OPERATORS
Operator Meaning
& bitwise AND
! bitwise OR
^ bitwise exclusive OR
~ one's complement
<< shift left
Dot Operator
personl.age // Reference to the variable age
person1.salary ()
Control statements
Conditional Statement
If
If-else
If-elseif-else(Elseif Ladder)
Switch case
Looping Statement
While
Do-while
For
Foreach
THANK YOU!!