SlideShare a Scribd company logo
Object Oriented
Programming
Lecture 2
Asif Shahzad
Assistant Professor
COMSATS University, Lahore Campus
Java Language Basics - Variables
• 4 things about a variables
• Name … Naming rules and conventions
• Type
• Size .. Bytes it consume in main memory
• Value .. Default value and literals
• Variable types in Java
• Primitive Types
• Reference Types
Primitive and Reference Types
• Primitive Types
• Basic variable types provided by Java languages
• Primitive types, literals, and ranges (of integral types)
• Reference Types
• These are usually created using primitives and other reference types
• There exist built-in reference types (Scanner, System, etc.) and we can
create our own reference types too
• Reference types are created by creating classes in Java … more details later
Java Language Basics – Escape Sequence
• Escape Sequences:
• b (backspace)
• t (tab)
• n (line feed)
• r (carriage return)
• " (double quote)
• ' (single quote)
•  (backslash)
Java Language Basics
• Format Specifiers
• System.print* methods
• Getting different types of input from User

More Related Content

What's hot

Java01
Java01Java01
Java01
Remon Hanna
 
RIBBUN SOFTWARE
RIBBUN SOFTWARERIBBUN SOFTWARE
RIBBUN SOFTWARE
mosewoodward24
 
[OOP - Lec 04,05] Basic Building Blocks of OOP
[OOP - Lec 04,05] Basic Building Blocks of OOP[OOP - Lec 04,05] Basic Building Blocks of OOP
[OOP - Lec 04,05] Basic Building Blocks of OOP
Muhammad Hammad Waseem
 
24csharp
24csharp24csharp
24csharp
Sireesh K
 
Microsoft .Net
Microsoft .NetMicrosoft .Net
Microsoft .Net
Jeevan Kumar Reddy
 
OOPS – General Understanding in .NET
OOPS – General Understanding in .NETOOPS – General Understanding in .NET
OOPS – General Understanding in .NET
Sabith Byari
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
Saiful Islam Sany
 
2 Day Android Workshop
2 Day Android Workshop2 Day Android Workshop
2 Day Android Workshop
Daniel M.Idrees
 
Input & output
Input & outputInput & output
Input & output
SAIFUR RAHMAN
 
Introduction to oop and java fundamentals
Introduction to oop and java fundamentalsIntroduction to oop and java fundamentals
Introduction to oop and java fundamentals
AnsgarMary
 
Core Java Training in Bangalore | Best Core Java Class in Bangalore
Core Java Training in Bangalore | Best Core Java Class in BangaloreCore Java Training in Bangalore | Best Core Java Class in Bangalore
Core Java Training in Bangalore | Best Core Java Class in Bangalore
TIB Academy
 
Oopsinphp
OopsinphpOopsinphp
Oopsinphp
NithyaNithyav
 
cpp-2013 #7 Templates and STL Containers
cpp-2013 #7 Templates and STL Containerscpp-2013 #7 Templates and STL Containers
cpp-2013 #7 Templates and STL ContainersAmazon Web Services
 

What's hot (13)

Java01
Java01Java01
Java01
 
RIBBUN SOFTWARE
RIBBUN SOFTWARERIBBUN SOFTWARE
RIBBUN SOFTWARE
 
[OOP - Lec 04,05] Basic Building Blocks of OOP
[OOP - Lec 04,05] Basic Building Blocks of OOP[OOP - Lec 04,05] Basic Building Blocks of OOP
[OOP - Lec 04,05] Basic Building Blocks of OOP
 
24csharp
24csharp24csharp
24csharp
 
Microsoft .Net
Microsoft .NetMicrosoft .Net
Microsoft .Net
 
OOPS – General Understanding in .NET
OOPS – General Understanding in .NETOOPS – General Understanding in .NET
OOPS – General Understanding in .NET
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
2 Day Android Workshop
2 Day Android Workshop2 Day Android Workshop
2 Day Android Workshop
 
Input & output
Input & outputInput & output
Input & output
 
Introduction to oop and java fundamentals
Introduction to oop and java fundamentalsIntroduction to oop and java fundamentals
Introduction to oop and java fundamentals
 
Core Java Training in Bangalore | Best Core Java Class in Bangalore
Core Java Training in Bangalore | Best Core Java Class in BangaloreCore Java Training in Bangalore | Best Core Java Class in Bangalore
Core Java Training in Bangalore | Best Core Java Class in Bangalore
 
Oopsinphp
OopsinphpOopsinphp
Oopsinphp
 
cpp-2013 #7 Templates and STL Containers
cpp-2013 #7 Templates and STL Containerscpp-2013 #7 Templates and STL Containers
cpp-2013 #7 Templates and STL Containers
 

Similar to Lec02 primitive types

cs213Lecture_1 java programming oopsss.pptx
cs213Lecture_1 java programming oopsss.pptxcs213Lecture_1 java programming oopsss.pptx
cs213Lecture_1 java programming oopsss.pptx
mshanajoel6
 
Beginning Java for .NET developers
Beginning Java for .NET developersBeginning Java for .NET developers
Beginning Java for .NET developers
Andrei Rinea
 
Character stream classes introd .51
Character stream classes introd  .51Character stream classes introd  .51
Character stream classes introd .51myrajendra
 
ppt_on_java.pptx
ppt_on_java.pptxppt_on_java.pptx
ppt_on_java.pptx
MAYANKKUMAR492040
 
Complete PPT about the Java lokesh kept it
Complete PPT about the Java lokesh kept itComplete PPT about the Java lokesh kept it
Complete PPT about the Java lokesh kept it
lokeshpappaka10
 
Presentation on java
Presentation  on  javaPresentation  on  java
Presentation on java
shashi shekhar
 
Apache Con 2021 Structured Data Streaming
Apache Con 2021 Structured Data StreamingApache Con 2021 Structured Data Streaming
Apache Con 2021 Structured Data Streaming
Shivji Kumar Jha
 
Presentation 1.pptx
Presentation 1.pptxPresentation 1.pptx
Presentation 1.pptx
PranavSoni19
 
Core java Training in Chennai
Core java Training in ChennaiCore java Training in Chennai
Core java Training in Chennai
Core Mind
 
Java
JavaJava
Top 100 Java Interview Questions with Detailed Answers
Top 100 Java Interview Questions with Detailed AnswersTop 100 Java Interview Questions with Detailed Answers
Top 100 Java Interview Questions with Detailed Answers
Whizlabs
 
Anaphora Resolution
Anaphora ResolutionAnaphora Resolution
Anaphora ResolutionFindwise
 
Basic online java course - Brainsmartlabs
Basic online java course  - BrainsmartlabsBasic online java course  - Brainsmartlabs
Basic online java course - Brainsmartlabs
brainsmartlabsedu
 
Introduction to oops
Introduction to oopsIntroduction to oops
Introduction to oops
Umamaheshwariv1
 
Java core - Detailed Overview
Java  core - Detailed OverviewJava  core - Detailed Overview
Java core - Detailed Overview
Buddha Tree
 
Datatype
DatatypeDatatype
Datatype
baran19901990
 

Similar to Lec02 primitive types (20)

cs213Lecture_1 java programming oopsss.pptx
cs213Lecture_1 java programming oopsss.pptxcs213Lecture_1 java programming oopsss.pptx
cs213Lecture_1 java programming oopsss.pptx
 
java introduction
java introductionjava introduction
java introduction
 
Beginning Java for .NET developers
Beginning Java for .NET developersBeginning Java for .NET developers
Beginning Java for .NET developers
 
Character stream classes introd .51
Character stream classes introd  .51Character stream classes introd  .51
Character stream classes introd .51
 
ppt_on_java.pptx
ppt_on_java.pptxppt_on_java.pptx
ppt_on_java.pptx
 
Complete PPT about the Java lokesh kept it
Complete PPT about the Java lokesh kept itComplete PPT about the Java lokesh kept it
Complete PPT about the Java lokesh kept it
 
Presentation on java
Presentation  on  javaPresentation  on  java
Presentation on java
 
Apache Con 2021 Structured Data Streaming
Apache Con 2021 Structured Data StreamingApache Con 2021 Structured Data Streaming
Apache Con 2021 Structured Data Streaming
 
Presentation 1.pptx
Presentation 1.pptxPresentation 1.pptx
Presentation 1.pptx
 
Core java Training in Chennai
Core java Training in ChennaiCore java Training in Chennai
Core java Training in Chennai
 
Java
JavaJava
Java
 
Top 100 Java Interview Questions with Detailed Answers
Top 100 Java Interview Questions with Detailed AnswersTop 100 Java Interview Questions with Detailed Answers
Top 100 Java Interview Questions with Detailed Answers
 
Anaphora Resolution
Anaphora ResolutionAnaphora Resolution
Anaphora Resolution
 
Basic online java course - Brainsmartlabs
Basic online java course  - BrainsmartlabsBasic online java course  - Brainsmartlabs
Basic online java course - Brainsmartlabs
 
Php
PhpPhp
Php
 
Php
PhpPhp
Php
 
Php
PhpPhp
Php
 
Introduction to oops
Introduction to oopsIntroduction to oops
Introduction to oops
 
Java core - Detailed Overview
Java  core - Detailed OverviewJava  core - Detailed Overview
Java core - Detailed Overview
 
Datatype
DatatypeDatatype
Datatype
 

More from Asif Shahzad

Cascading Style Sheets CSS
Cascading Style Sheets CSS Cascading Style Sheets CSS
Cascading Style Sheets CSS
Asif Shahzad
 
Lec03 print on console and getting input
Lec03   print on console and getting inputLec03   print on console and getting input
Lec03 print on console and getting input
Asif Shahzad
 
Lec01 intro and hello world program
Lec01   intro and hello world programLec01   intro and hello world program
Lec01 intro and hello world program
Asif Shahzad
 
Lec08 constructors
Lec08   constructorsLec08   constructors
Lec08 constructors
Asif Shahzad
 
Lec07 data hiding and encapsulation
Lec07   data hiding and encapsulationLec07   data hiding and encapsulation
Lec07 data hiding and encapsulation
Asif Shahzad
 
Lec04 if-else and loops
Lec04   if-else and loopsLec04   if-else and loops
Lec04 if-else and loops
Asif Shahzad
 
Lec05 class and object
Lec05   class and objectLec05   class and object
Lec05 class and object
Asif Shahzad
 
Cv writing and job search
Cv writing and job searchCv writing and job search
Cv writing and job search
Asif Shahzad
 
Domain Name System (DNS) - Domain Registration and Website Hosting Basics
Domain Name System (DNS) - Domain Registration and Website Hosting BasicsDomain Name System (DNS) - Domain Registration and Website Hosting Basics
Domain Name System (DNS) - Domain Registration and Website Hosting Basics
Asif Shahzad
 
Scope of Information Technology
Scope of Information TechnologyScope of Information Technology
Scope of Information Technology
Asif Shahzad
 

More from Asif Shahzad (10)

Cascading Style Sheets CSS
Cascading Style Sheets CSS Cascading Style Sheets CSS
Cascading Style Sheets CSS
 
Lec03 print on console and getting input
Lec03   print on console and getting inputLec03   print on console and getting input
Lec03 print on console and getting input
 
Lec01 intro and hello world program
Lec01   intro and hello world programLec01   intro and hello world program
Lec01 intro and hello world program
 
Lec08 constructors
Lec08   constructorsLec08   constructors
Lec08 constructors
 
Lec07 data hiding and encapsulation
Lec07   data hiding and encapsulationLec07   data hiding and encapsulation
Lec07 data hiding and encapsulation
 
Lec04 if-else and loops
Lec04   if-else and loopsLec04   if-else and loops
Lec04 if-else and loops
 
Lec05 class and object
Lec05   class and objectLec05   class and object
Lec05 class and object
 
Cv writing and job search
Cv writing and job searchCv writing and job search
Cv writing and job search
 
Domain Name System (DNS) - Domain Registration and Website Hosting Basics
Domain Name System (DNS) - Domain Registration and Website Hosting BasicsDomain Name System (DNS) - Domain Registration and Website Hosting Basics
Domain Name System (DNS) - Domain Registration and Website Hosting Basics
 
Scope of Information Technology
Scope of Information TechnologyScope of Information Technology
Scope of Information Technology
 

Recently uploaded

Software Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdfSoftware Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdf
MayankTawar1
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Anthony Dahanne
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
Tendenci - The Open Source AMS (Association Management Software)
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
Visitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.appVisitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.app
NaapbooksPrivateLimi
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Strategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptxStrategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptx
varshanayak241
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
XfilesPro
 

Recently uploaded (20)

Software Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdfSoftware Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdf
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
Visitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.appVisitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.app
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Strategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptxStrategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptx
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
 

Lec02 primitive types

  • 1. Object Oriented Programming Lecture 2 Asif Shahzad Assistant Professor COMSATS University, Lahore Campus
  • 2. Java Language Basics - Variables • 4 things about a variables • Name … Naming rules and conventions • Type • Size .. Bytes it consume in main memory • Value .. Default value and literals • Variable types in Java • Primitive Types • Reference Types
  • 3. Primitive and Reference Types • Primitive Types • Basic variable types provided by Java languages • Primitive types, literals, and ranges (of integral types) • Reference Types • These are usually created using primitives and other reference types • There exist built-in reference types (Scanner, System, etc.) and we can create our own reference types too • Reference types are created by creating classes in Java … more details later
  • 4.
  • 5. Java Language Basics – Escape Sequence • Escape Sequences: • b (backspace) • t (tab) • n (line feed) • r (carriage return) • " (double quote) • ' (single quote) • (backslash)
  • 6. Java Language Basics • Format Specifiers • System.print* methods • Getting different types of input from User

Editor's Notes

  1. byte, short, char, integer, long, float, double, boolean