SlideShare a Scribd company logo
1 of 29
JAVA
Created by- Pratham Vaishnav
Content
• Introduction to Java
• Object Oriented Programming
• What is a Class
• Starting Java
• Constants
• Data types
• Variables
• Keywords
• Operators
• Statements
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
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
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.
Data
Abstraction
Abstraction is a
process of hiding
the
implementation
details and
showing only
functionality to
the user.
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.
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
Polymorphism
Polymorphism is
a characteristic
of being able to
assign a different
behavior or value
in subclass, to
something that
was declared in
parent class.
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.
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
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
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”
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)
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;
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
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
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
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
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
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
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
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.
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
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
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.
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.
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.
THANK YOU
Thank you for visiting my presentation and
viewing it and I hope you liked and
downloaded it.

More Related Content

Similar to Guide to Java.pptx

C operators
C operatorsC operators
C operatorsGPERI
 
Basics of Javascript
Basics of Javascript Basics of Javascript
Basics of Javascript poojanov04
 
In this page, we will learn about the basics of OOPs. Object-Oriented Program...
In this page, we will learn about the basics of OOPs. Object-Oriented Program...In this page, we will learn about the basics of OOPs. Object-Oriented Program...
In this page, we will learn about the basics of OOPs. Object-Oriented Program...Indu32
 
GUI Programming in JAVA (Using Netbeans) - A Review
GUI Programming in JAVA (Using Netbeans) -  A ReviewGUI Programming in JAVA (Using Netbeans) -  A Review
GUI Programming in JAVA (Using Netbeans) - A ReviewFernando Torres
 
Lecture - 3 Variables-data type_operators_oops concept
Lecture - 3 Variables-data type_operators_oops conceptLecture - 3 Variables-data type_operators_oops concept
Lecture - 3 Variables-data type_operators_oops conceptmanish kumar
 
Introduction to c
Introduction to cIntroduction to c
Introduction to cAjeet Kumar
 
Ch3- Java Script.pdf
Ch3- Java Script.pdfCh3- Java Script.pdf
Ch3- Java Script.pdfHASENSEID
 
Core Java introduction | Basics | free course
Core Java introduction | Basics | free course Core Java introduction | Basics | free course
Core Java introduction | Basics | free course Kernel Training
 
classVI_Coding_Teacher_Presentation.pptx
classVI_Coding_Teacher_Presentation.pptxclassVI_Coding_Teacher_Presentation.pptx
classVI_Coding_Teacher_Presentation.pptxssusere336f4
 
INTRODUCTION TO CODING-CLASS VI LEVEL-DESCRIPTION ABOUT SYNTAX LANGUAGE
INTRODUCTION TO CODING-CLASS VI LEVEL-DESCRIPTION ABOUT SYNTAX LANGUAGEINTRODUCTION TO CODING-CLASS VI LEVEL-DESCRIPTION ABOUT SYNTAX LANGUAGE
INTRODUCTION TO CODING-CLASS VI LEVEL-DESCRIPTION ABOUT SYNTAX LANGUAGERathnaM16
 
Java developer trainee implementation and import
Java developer trainee implementation and importJava developer trainee implementation and import
Java developer trainee implementation and importiamluqman0403
 
Android webinar class_java_review
Android webinar class_java_reviewAndroid webinar class_java_review
Android webinar class_java_reviewEdureka!
 
Java script.pptx v
Java script.pptx                                     vJava script.pptx                                     v
Java script.pptx v22x026
 

Similar to Guide to Java.pptx (20)

C operators
C operatorsC operators
C operators
 
Basics of Javascript
Basics of Javascript Basics of Javascript
Basics of Javascript
 
In this page, we will learn about the basics of OOPs. Object-Oriented Program...
In this page, we will learn about the basics of OOPs. Object-Oriented Program...In this page, we will learn about the basics of OOPs. Object-Oriented Program...
In this page, we will learn about the basics of OOPs. Object-Oriented Program...
 
Operators in java By cheena
Operators in java By cheenaOperators in java By cheena
Operators in java By cheena
 
Operators in java
Operators in javaOperators in java
Operators in java
 
GUI Programming in JAVA (Using Netbeans) - A Review
GUI Programming in JAVA (Using Netbeans) -  A ReviewGUI Programming in JAVA (Using Netbeans) -  A Review
GUI Programming in JAVA (Using Netbeans) - A Review
 
Lecture - 3 Variables-data type_operators_oops concept
Lecture - 3 Variables-data type_operators_oops conceptLecture - 3 Variables-data type_operators_oops concept
Lecture - 3 Variables-data type_operators_oops concept
 
Introduction to c
Introduction to cIntroduction to c
Introduction to c
 
Ch3- Java Script.pdf
Ch3- Java Script.pdfCh3- Java Script.pdf
Ch3- Java Script.pdf
 
Core Java introduction | Basics | free course
Core Java introduction | Basics | free course Core Java introduction | Basics | free course
Core Java introduction | Basics | free course
 
classVI_Coding_Teacher_Presentation.pptx
classVI_Coding_Teacher_Presentation.pptxclassVI_Coding_Teacher_Presentation.pptx
classVI_Coding_Teacher_Presentation.pptx
 
INTRODUCTION TO CODING-CLASS VI LEVEL-DESCRIPTION ABOUT SYNTAX LANGUAGE
INTRODUCTION TO CODING-CLASS VI LEVEL-DESCRIPTION ABOUT SYNTAX LANGUAGEINTRODUCTION TO CODING-CLASS VI LEVEL-DESCRIPTION ABOUT SYNTAX LANGUAGE
INTRODUCTION TO CODING-CLASS VI LEVEL-DESCRIPTION ABOUT SYNTAX LANGUAGE
 
Basic concept of c++
Basic concept of c++Basic concept of c++
Basic concept of c++
 
Java developer trainee implementation and import
Java developer trainee implementation and importJava developer trainee implementation and import
Java developer trainee implementation and import
 
Android webinar class_java_review
Android webinar class_java_reviewAndroid webinar class_java_review
Android webinar class_java_review
 
Week2 dq4
Week2 dq4Week2 dq4
Week2 dq4
 
Lecture 05.pptx
Lecture 05.pptxLecture 05.pptx
Lecture 05.pptx
 
Java script basic
Java script basicJava script basic
Java script basic
 
Core java
Core javaCore java
Core java
 
Java script.pptx v
Java script.pptx                                     vJava script.pptx                                     v
Java script.pptx v
 

Recently uploaded

GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
software engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxsoftware engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxnada99848
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 

Recently uploaded (20)

GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
software engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxsoftware engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptx
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 

Guide to Java.pptx

  • 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.
  • 6. Data Abstraction Abstraction is a process of hiding the implementation details and showing only functionality to the user.
  • 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
  • 9. Polymorphism Polymorphism is a characteristic of being able to assign a different behavior or value in subclass, to something that was declared in parent 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.