Here you can watch my ppt and learn the guide about java and its every part. Later on, I will make one more ppt on many programs and keywords and how to use them, I hope you like this presentation.
Thank you
2. Content
• Introduction to Java
• Object Oriented Programming
• What is a Class
• Starting Java
• Constants
• Data types
• Variables
• Keywords
• Operators
• Statements
3. Introduction to Java
Java is a powerful high level language and you can prepare
your programs in it depending upon your requirements. It
was developed in 1991 in the USA by Sun Microsystems. It
is much reliable and portable language.
Features of Java
• It is portable
• Works on all platforms
• It is object oriented
• It is suitable for internet, web designing etc.
• It is robust language
• It is highly reliable
4. Object Oriented Programming
Object Oriented Programming is a methodology to design a
program using classes and objects. It works on a very
important principle that objects are most important part of
your program
It simplifies the software development and maintenance by
providing some concepts :
• Object
• Class
• Inheritance
• Polymorphism
• Abstraction
• Encapsulation
5. What is object?
Object is a
instance of class
having a state
and behavior. A
software object’s
state is stored in
fields and
behavior is
shown via
methods.
7. Encapsulation
Encapsulation is
the way in which
both data (data
means
characteristics)
and the
functions(means
behavior) reside
that work on data
under a single
unit.
8. Inheritance
Inheritance is a
technique which
is used to derive
or build new
classes from
existing one to
build object
oriented
hierarchy. A
class may be
derived from one
or more classes,
it is called
derived class
10. What is a Class?
A class is a collection of objects. A class is an abstraction
for set of objects. It can be thought of as a factory that can
produce objects using constructors.
Eg.
Class Object
(Color) Red
Green
Orange
Blue etc.
11. Starting Java
A java program has some starting basics and some
format to make a program. A program must consist of
the following-
Constants
Data Types
Variable
Keywords
Operators
Optional-
• Statements
• Loops
12. Constants
Constants are fixed values that do not change during the
execution of the program.
Integer Constants
These are the sequence of digits (whole numbers). They are of
three types-decimal, octal and hexadecimal.
Eg.
120 375 -120 123456.
Real Constants
These are the numbers containing fractional part e.g., 123.35.
These are also called floating constants.
Eg.
0.0123 -0.0123 420.420
13. Constants
Single Character Constants
A single character contains only single character enclosed
within single quotes.
Eg.
‘A’ ‘7’ ‘.’ etc.
String Constants
A string constant is a sequence of characters enclosed in
double quotes.
Eg.
“Hello Sir” “2003” “10+12”
14. Data Types
Type Bytes Use
byte 1 -128 to 127
short 2 -32,768 to 32,767
int 4 -2,147,483,648 to
2,147,483,647
long 8 Long integers 12x times
int
float 4 Single precision,-
3.4x1038to3.4x1038
double 8 Double precision
char 2 Single unicode character
boolean 1 True(1) or False(0)
15. Variable
A variable is a quantity which varies during a program
execution. A variable is the name of location where the
information is stored, this location exists in computer
memory.
To declare a variable a data type is required
Syntax: datatype variablename;
16. Operators
An operator is a symbol or letter which causes the compiler
to take an action and yield a value. An operator acts on
different data items/entities called Operands.
It is of following types-
• Arithmetic operators
• Increment/Decrement Operators
• Bitwise Operators
• Relational Operators
• Conditional Operators
• Logical Operators
17. Arithmetic Operator
Arithmetical operators are used for various mathematical
calculations. The result of an arithmetical expression is a
numerical value.
This operator is of two types-
Unary Arithmetic Operator
Binary Arithmetic Operator
18. Unary and Binary operators
Unary operator tells us is a number positive or negative.
It comprises of two operators + and – only.
Eg. x= -10 x= +10
Binary operators creates an expression when combined
with constants or variables. It comprises of-
• Addition Operator (+) -to add
• Subtraction Operator (-) -to subtract
• Multiplication Operator (*) -to multiply
• Division Operator (/) -to find quotient
• Modulus Operator (%) -to find remainder
19. Increment & Decrement Operator
Increment operator is denoted by ++ and decrement
operator by --. Increment adds one and decrement
subtracts one. These operator can be used in two ways-
Prefix
In this operator comes before variable
Eg. ++i
Postfix
In this operator comes after variable
Eg. i++*9
20. Relational Operators
Relational operators are used to determine the relationship
between different operands. These are used in the work of
comparison also. The two mathematical expressions can
be compared by a relational operator.
This comprises of following six relational operators-
Symbol Meaning
> Greater than
< Less than
>= Greater than or equal to
<= Less than or equal to
= = Equal to
!= Not equal to
21. Logical operators
These operator check the condition is true or false
according to program. It returns 1 if true and 0 if false.
This logical operators comprises of 3 operator-
= ! - Logical negation NOT
= || - Logical OR
= && - Logical AND
22. OR operator
OR operator
If
-operand 1 and 2 is false then result false
-operand 1 true and 2 true then result true
-operand 1 false or 2 false and 1 true or 2 true then
result is true
23. NOT operator
NOT operator
If
-the expression is Zero , ! Expression is 1(true)
-the expression is Non zero , ! Expression is 0 (false)
Note: this operator works on a single operand referred to
as Unary operator.
24. AND operator
&& operator
If
-first or second is false then result is false.
-both expression true then result true
-both expression false result is false
eg.
(15 == 3)&&(8 == 8) -False
(5 == 5)&&(8 == 8) -True
(5>9)&&(6>8) -False
25. Statements
Statement are the instructions given to program to tell it
what to do. Statement is of two types-
=>control flow statements
-selection statement
-switch statement
=>repetitive statements
-While loop
-Do while loop
26. Control flow statement
Control flow statements depend the result on how the user
interacts with the input.
It is of two types-
= selection statement
= switch statement
To construct this statement-
-Sequence
-Selection
Is required.
27. Selection statement
Selection statement lets the user decide how the result
should be, or you can simply compare it with the command
if and if-else and if-else-if and also these are the operators
this statement comprises of.
Syntax-
If(5==5)
Statement 1;
Else
Statement 2;
Note: in the if command only one result could happen else
there is no result so condition must be according to
program for result.
28. Repetitive Statement
In this statement the user inputs and the output is repeated
many times according to program this is useful for many
situation instead of copying and pasting program again and
again you can simply make repeat itself.
This repetitive statement you can simply say as Loop it
comprises of-
~While loop -It will not execute statement if false.
~Do-While loop -even being false it will execute once
the statement.
29. THANK YOU
Thank you for visiting my presentation and
viewing it and I hope you liked and
downloaded it.