SlideShare a Scribd company logo
1
Introduction to JavaIntroduction to Java
Version 1.0Version 1.0
2
Course ObjectiveCourse Objective
• The Objective of Java course is:The Objective of Java course is:
– To understand basic programming concepts using JavaTo understand basic programming concepts using Java
syntax.syntax.
– To appreciate OOP concepts and encourage problemTo appreciate OOP concepts and encourage problem
solving using OOP techniques.solving using OOP techniques.
– To understand various Java API and how to use themTo understand various Java API and how to use them
effectively in projects.effectively in projects.
– To understand the need for exception handling and howTo understand the need for exception handling and how
to use in Java environment.to use in Java environment.
3
What is Java?What is Java?
• Java is both:Java is both:
– A Programming languageA Programming language
– A PlatformA Platform
4
The Java ProgrammingThe Java Programming
LanguageLanguage
• Java is an Object Oriented Programming language.Java is an Object Oriented Programming language.
• Java’s syntax is similar to C / C++ syntax.Java’s syntax is similar to C / C++ syntax.
• Java is both compiled and interpreted.Java is both compiled and interpreted.
• The intermediate form is called Java byte code, which isThe intermediate form is called Java byte code, which is
platform independent.platform independent.
• Byte codes are interpreted by JVM during runtime.Byte codes are interpreted by JVM during runtime.
5
Java PlatformJava Platform
• The Java Platform has twoThe Java Platform has two
components:components:
–The Java Virtual Machine (JVM)The Java Virtual Machine (JVM)
–The Java Application ProgrammingThe Java Application Programming
Interface (Java API)Interface (Java API)
6
The Java PlatformThe Java Platform
• The Java VM is base for Java platform and isThe Java VM is base for Java platform and is
ported onto various hardware-based and OS basedported onto various hardware-based and OS based
platforms.platforms.
• The Java API is a large collection of ready-made,The Java API is a large collection of ready-made,
frequently used class libraries, stored in packages.frequently used class libraries, stored in packages.
7
The Java EnvironmentThe Java Environment
Java Program
Java Virtual machine
Native OS / Platform
Java API
JAVA
PLATFORM
8
A Simple Java ProgramA Simple Java Program
/** This is our first Java Program *//** This is our first Java Program */
class FirstClassclass FirstClass
{{
public static void main(String args[])public static void main(String args[])
{{
System.out.println(“Hello World.”);System.out.println(“Hello World.”);
}}
}}
9
Compiling and Running in EclipseCompiling and Running in Eclipse
10
Java Data TypesJava Data Types
• Two major data typesTwo major data types
– PrimitivePrimitive
• Because java program has to run on differentBecause java program has to run on different
architecture and OS, the size of the data shouldarchitecture and OS, the size of the data should
remain same. Otherwise, on different machines theremain same. Otherwise, on different machines the
output will be differentoutput will be different
– ReferenceReference
• All objects are of type reference data type. JavaAll objects are of type reference data type. Java
doesn’t allow directly to access memory. But objectsdoesn’t allow directly to access memory. But objects
are refered by pointers only.are refered by pointers only.
11
Primitive Data TypesPrimitive Data Types
• IntegersIntegers
–bytebyte (8 bit)(8 bit)
–shortshort (16 bit)(16 bit)
–intint (32 bit)(32 bit)
–longlong (64 bit)(64 bit)
12
Primitive Data TypesPrimitive Data Types
• Real NumbersReal Numbers
– floatfloat (32 bit)(32 bit)
– doubledouble (64 bit)(64 bit)
• Other TypesOther Types
– charchar (16 bit)(16 bit)
– booleanboolean (true / false)(true / false)
13
Reference Data TypesReference Data Types
• Examples:Examples:
– ArraysArrays
– StringsStrings
– ObjectsObjects
– InterfacesInterfaces
• The name reference means a pointer in the memory. AllThe name reference means a pointer in the memory. All
objects are referred by their memory location only. Butobjects are referred by their memory location only. But
user cannot directly access memory location.user cannot directly access memory location.
• Memory management is taken care by JVM itself.Memory management is taken care by JVM itself.
14
Variable NamesVariable Names
• Variable names in Java are legal Java identifier comprisedVariable names in Java are legal Java identifier comprised
of a series of Unicode characters.of a series of Unicode characters.
• Variable names must not be Java keyword or a booleanVariable names must not be Java keyword or a boolean
literalliteral
• Same variable name should not appear twice within aSame variable name should not appear twice within a
scope.scope.
15
Java OperatorsJava Operators
• Arithmetic OperatorsArithmetic Operators
+, -, *, /, %+, -, *, /, %
• Unary Arithmetic OperatorsUnary Arithmetic Operators
++, --++, --
• Relational and Conditional OperatorsRelational and Conditional Operators
>, >=, <, <=, ==, !=, &&, ||, !>, >=, <, <=, ==, !=, &&, ||, !
• Bitwise OperatorsBitwise Operators
>>, <<, >>>, &, |, ^, ~>>, <<, >>>, &, |, ^, ~
• Ternary Operator: ()?():()Ternary Operator: ()?():()
16
Control FlowControl Flow
• Decision makingDecision making
– if-else, switch-caseif-else, switch-case
• LoopLoop
– for, while, do-whilefor, while, do-while
• ExceptionException
– try-catch-finally, throwtry-catch-finally, throw
• MiscellaneousMiscellaneous
– Break, continue, label:, returnBreak, continue, label:, return
17
Arrays in JavaArrays in Java
• Java arrays are objects.Java arrays are objects.
• Array contains like-typed values.Array contains like-typed values.
• Array can contain both primitive and reference data types.Array can contain both primitive and reference data types.
• When used with reference data types, reference (memoryWhen used with reference data types, reference (memory
location) is only stored in arrays and not the real objects.location) is only stored in arrays and not the real objects.
• Java supports multidimensional arrays. They are nothingJava supports multidimensional arrays. They are nothing
but ‘array of arrays’.but ‘array of arrays’.
18
Arrays in JavaArrays in Java
• Array DeclarationArray Declaration
– int myIntegers[];int myIntegers[];
– int[] myIntegers;int[] myIntegers;
• Array memory allocation:Array memory allocation:
– int myIntegers[] = new int[10];int myIntegers[] = new int[10];
• Array Initialization:Array Initialization:
– int myIntegers[] = {1,2,3,4,5};int myIntegers[] = {1,2,3,4,5};
19
Strings in JavaStrings in Java
• A sequence of characters is encapsulated as a StringA sequence of characters is encapsulated as a String
object.object.
• Java uses ‘+’ operator for String concatenation.Java uses ‘+’ operator for String concatenation.
• Some useful String functions are:Some useful String functions are:
– s.length();s.length();
– s1.equals(s2);s1.equals(s2);
– s1.subString(int startIndex, int upTo);s1.subString(int startIndex, int upTo);
20
SummarySummary
• In this session you learned about:In this session you learned about:
– Java Programming LanguageJava Programming Language
– Java PlatformJava Platform
– Java EnvironmentJava Environment
– First Java ProgramFirst Java Program
– Data TypesData Types
– OperatorsOperators
– Control FlowControl Flow
– Java Arrays and StringsJava Arrays and Strings

More Related Content

What's hot

Programming the Semantic Web
Programming the Semantic WebProgramming the Semantic Web
Programming the Semantic Web
Luigi De Russis
 
Java basic
Java basicJava basic
Java basic
Pooja Thakur
 
iOS Programming Intro
iOS Programming IntroiOS Programming Intro
iOS Programming Intro
Lou Loizides
 
Louis Loizides iOS Programming Introduction
Louis Loizides iOS Programming IntroductionLouis Loizides iOS Programming Introduction
Louis Loizides iOS Programming Introduction
Lou Loizides
 
04 inheritance
04 inheritance04 inheritance
04 inheritance
Sumit Srivastava
 
Intro to Object Oriented Programming with Java
Intro to Object Oriented Programming with Java Intro to Object Oriented Programming with Java
Intro to Object Oriented Programming with Java
Hitesh-Java
 
Practical type mining in Scala
Practical type mining in ScalaPractical type mining in Scala
Practical type mining in Scala
Rose Toomey
 
Intro to Objective C
Intro to Objective CIntro to Objective C
Intro to Objective CAshiq Uz Zoha
 
Introduction to oop and java fundamentals
Introduction to oop and java fundamentalsIntroduction to oop and java fundamentals
Introduction to oop and java fundamentals
AnsgarMary
 
GETTING STARTED WITH JAVA(beginner)
GETTING STARTED WITH JAVA(beginner)GETTING STARTED WITH JAVA(beginner)
GETTING STARTED WITH JAVA(beginner)
HarshithaAllu
 
TypeScript Modules
TypeScript ModulesTypeScript Modules
TypeScript Modules
Noam Kfir
 
An Introduction to Scala
An Introduction to ScalaAn Introduction to Scala
An Introduction to ScalaBrent Lemons
 
Scala basic
Scala basicScala basic
Scala basic
Nguyen Tuan
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
AbhishekMondal42
 
Scala reflection
Scala reflectionScala reflection
Scala reflection
David Pichsenmeister
 
Java for the Beginners
Java for the BeginnersJava for the Beginners
Java for the Beginners
Biswadip Goswami
 
1 java - data type
1  java - data type1  java - data type
1 java - data type
vinay arora
 

What's hot (19)

Programming the Semantic Web
Programming the Semantic WebProgramming the Semantic Web
Programming the Semantic Web
 
Java
JavaJava
Java
 
Java basic
Java basicJava basic
Java basic
 
iOS Programming Intro
iOS Programming IntroiOS Programming Intro
iOS Programming Intro
 
Louis Loizides iOS Programming Introduction
Louis Loizides iOS Programming IntroductionLouis Loizides iOS Programming Introduction
Louis Loizides iOS Programming Introduction
 
04 inheritance
04 inheritance04 inheritance
04 inheritance
 
Intro to Object Oriented Programming with Java
Intro to Object Oriented Programming with Java Intro to Object Oriented Programming with Java
Intro to Object Oriented Programming with Java
 
Practical type mining in Scala
Practical type mining in ScalaPractical type mining in Scala
Practical type mining in Scala
 
Intro to Objective C
Intro to Objective CIntro to Objective C
Intro to Objective C
 
Introduction to oop and java fundamentals
Introduction to oop and java fundamentalsIntroduction to oop and java fundamentals
Introduction to oop and java fundamentals
 
GETTING STARTED WITH JAVA(beginner)
GETTING STARTED WITH JAVA(beginner)GETTING STARTED WITH JAVA(beginner)
GETTING STARTED WITH JAVA(beginner)
 
TypeScript Modules
TypeScript ModulesTypeScript Modules
TypeScript Modules
 
An Introduction to Scala
An Introduction to ScalaAn Introduction to Scala
An Introduction to Scala
 
core java
core javacore java
core java
 
Scala basic
Scala basicScala basic
Scala basic
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
 
Scala reflection
Scala reflectionScala reflection
Scala reflection
 
Java for the Beginners
Java for the BeginnersJava for the Beginners
Java for the Beginners
 
1 java - data type
1  java - data type1  java - data type
1 java - data type
 

Similar to java introduction

ppt_on_java.pptx
ppt_on_java.pptxppt_on_java.pptx
ppt_on_java.pptx
MAYANKKUMAR492040
 
Basic online java course - Brainsmartlabs
Basic online java course  - BrainsmartlabsBasic online java course  - Brainsmartlabs
Basic online java course - Brainsmartlabs
brainsmartlabsedu
 
Presentation on java
Presentation  on  javaPresentation  on  java
Presentation on java
shashi shekhar
 
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
 
Java notes | All Basics |
Java notes | All Basics |Java notes | All Basics |
Java notes | All Basics |
ShubhamAthawane
 
cs213Lecture_1 java programming oopsss.pptx
cs213Lecture_1 java programming oopsss.pptxcs213Lecture_1 java programming oopsss.pptx
cs213Lecture_1 java programming oopsss.pptx
mshanajoel6
 
intro_java (1).pptx
intro_java (1).pptxintro_java (1).pptx
intro_java (1).pptx
SmitNikumbh
 
U1 JAVA.pptx
U1 JAVA.pptxU1 JAVA.pptx
U1 JAVA.pptx
madan r
 
Unit 1 Core Java for Compter Science 3rd
Unit 1 Core Java for Compter Science 3rdUnit 1 Core Java for Compter Science 3rd
Unit 1 Core Java for Compter Science 3rd
prat0ham
 
Java SpringMVC SpringBOOT (Divergent).ppt
Java SpringMVC SpringBOOT (Divergent).pptJava SpringMVC SpringBOOT (Divergent).ppt
Java SpringMVC SpringBOOT (Divergent).ppt
Aayush Chimaniya
 
Java Course in Chandigarh
Java Course in ChandigarhJava Course in Chandigarh
Java Course in Chandigarh
Excellence Academy
 
Java interview questions and answers for cognizant By Data Council Pune
Java interview questions and answers for cognizant By Data Council PuneJava interview questions and answers for cognizant By Data Council Pune
Java interview questions and answers for cognizant By Data Council Pune
Pankaj kshirsagar
 
Module 1.pptx
Module 1.pptxModule 1.pptx
Module 1.pptx
YakaviBalakrishnan
 
1 Module 1 Introduction.pptx
1 Module 1 Introduction.pptx1 Module 1 Introduction.pptx
1 Module 1 Introduction.pptx
BhargaviDalal3
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
rishi ram khanal
 
java slides
java slidesjava slides
java slides
RizwanTariq18
 
chapter_one_Introduction_to_Object_Oriented_Programming_OOP.pptx
chapter_one_Introduction_to_Object_Oriented_Programming_OOP.pptxchapter_one_Introduction_to_Object_Oriented_Programming_OOP.pptx
chapter_one_Introduction_to_Object_Oriented_Programming_OOP.pptx
FiromsaDine
 

Similar to java introduction (20)

ppt_on_java.pptx
ppt_on_java.pptxppt_on_java.pptx
ppt_on_java.pptx
 
Basic online java course - Brainsmartlabs
Basic online java course  - BrainsmartlabsBasic online java course  - Brainsmartlabs
Basic online java course - Brainsmartlabs
 
Presentation on java
Presentation  on  javaPresentation  on  java
Presentation on 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
 
Java notes | All Basics |
Java notes | All Basics |Java notes | All Basics |
Java notes | All Basics |
 
cs213Lecture_1 java programming oopsss.pptx
cs213Lecture_1 java programming oopsss.pptxcs213Lecture_1 java programming oopsss.pptx
cs213Lecture_1 java programming oopsss.pptx
 
intro_java (1).pptx
intro_java (1).pptxintro_java (1).pptx
intro_java (1).pptx
 
U1 JAVA.pptx
U1 JAVA.pptxU1 JAVA.pptx
U1 JAVA.pptx
 
Unit 1 Core Java for Compter Science 3rd
Unit 1 Core Java for Compter Science 3rdUnit 1 Core Java for Compter Science 3rd
Unit 1 Core Java for Compter Science 3rd
 
Java SpringMVC SpringBOOT (Divergent).ppt
Java SpringMVC SpringBOOT (Divergent).pptJava SpringMVC SpringBOOT (Divergent).ppt
Java SpringMVC SpringBOOT (Divergent).ppt
 
Java Course in Chandigarh
Java Course in ChandigarhJava Course in Chandigarh
Java Course in Chandigarh
 
Java interview questions and answers for cognizant By Data Council Pune
Java interview questions and answers for cognizant By Data Council PuneJava interview questions and answers for cognizant By Data Council Pune
Java interview questions and answers for cognizant By Data Council Pune
 
Module 1.pptx
Module 1.pptxModule 1.pptx
Module 1.pptx
 
Comp102 lec 3
Comp102   lec 3Comp102   lec 3
Comp102 lec 3
 
1 Module 1 Introduction.pptx
1 Module 1 Introduction.pptx1 Module 1 Introduction.pptx
1 Module 1 Introduction.pptx
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
 
java slides
java slidesjava slides
java slides
 
chapter_one_Introduction_to_Object_Oriented_Programming_OOP.pptx
chapter_one_Introduction_to_Object_Oriented_Programming_OOP.pptxchapter_one_Introduction_to_Object_Oriented_Programming_OOP.pptx
chapter_one_Introduction_to_Object_Oriented_Programming_OOP.pptx
 
java notes.pdf
java notes.pdfjava notes.pdf
java notes.pdf
 
Java basics training 1
Java basics training 1Java basics training 1
Java basics training 1
 

Recently uploaded

Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 

Recently uploaded (20)

Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 

java introduction

  • 1. 1 Introduction to JavaIntroduction to Java Version 1.0Version 1.0
  • 2. 2 Course ObjectiveCourse Objective • The Objective of Java course is:The Objective of Java course is: – To understand basic programming concepts using JavaTo understand basic programming concepts using Java syntax.syntax. – To appreciate OOP concepts and encourage problemTo appreciate OOP concepts and encourage problem solving using OOP techniques.solving using OOP techniques. – To understand various Java API and how to use themTo understand various Java API and how to use them effectively in projects.effectively in projects. – To understand the need for exception handling and howTo understand the need for exception handling and how to use in Java environment.to use in Java environment.
  • 3. 3 What is Java?What is Java? • Java is both:Java is both: – A Programming languageA Programming language – A PlatformA Platform
  • 4. 4 The Java ProgrammingThe Java Programming LanguageLanguage • Java is an Object Oriented Programming language.Java is an Object Oriented Programming language. • Java’s syntax is similar to C / C++ syntax.Java’s syntax is similar to C / C++ syntax. • Java is both compiled and interpreted.Java is both compiled and interpreted. • The intermediate form is called Java byte code, which isThe intermediate form is called Java byte code, which is platform independent.platform independent. • Byte codes are interpreted by JVM during runtime.Byte codes are interpreted by JVM during runtime.
  • 5. 5 Java PlatformJava Platform • The Java Platform has twoThe Java Platform has two components:components: –The Java Virtual Machine (JVM)The Java Virtual Machine (JVM) –The Java Application ProgrammingThe Java Application Programming Interface (Java API)Interface (Java API)
  • 6. 6 The Java PlatformThe Java Platform • The Java VM is base for Java platform and isThe Java VM is base for Java platform and is ported onto various hardware-based and OS basedported onto various hardware-based and OS based platforms.platforms. • The Java API is a large collection of ready-made,The Java API is a large collection of ready-made, frequently used class libraries, stored in packages.frequently used class libraries, stored in packages.
  • 7. 7 The Java EnvironmentThe Java Environment Java Program Java Virtual machine Native OS / Platform Java API JAVA PLATFORM
  • 8. 8 A Simple Java ProgramA Simple Java Program /** This is our first Java Program *//** This is our first Java Program */ class FirstClassclass FirstClass {{ public static void main(String args[])public static void main(String args[]) {{ System.out.println(“Hello World.”);System.out.println(“Hello World.”); }} }}
  • 9. 9 Compiling and Running in EclipseCompiling and Running in Eclipse
  • 10. 10 Java Data TypesJava Data Types • Two major data typesTwo major data types – PrimitivePrimitive • Because java program has to run on differentBecause java program has to run on different architecture and OS, the size of the data shouldarchitecture and OS, the size of the data should remain same. Otherwise, on different machines theremain same. Otherwise, on different machines the output will be differentoutput will be different – ReferenceReference • All objects are of type reference data type. JavaAll objects are of type reference data type. Java doesn’t allow directly to access memory. But objectsdoesn’t allow directly to access memory. But objects are refered by pointers only.are refered by pointers only.
  • 11. 11 Primitive Data TypesPrimitive Data Types • IntegersIntegers –bytebyte (8 bit)(8 bit) –shortshort (16 bit)(16 bit) –intint (32 bit)(32 bit) –longlong (64 bit)(64 bit)
  • 12. 12 Primitive Data TypesPrimitive Data Types • Real NumbersReal Numbers – floatfloat (32 bit)(32 bit) – doubledouble (64 bit)(64 bit) • Other TypesOther Types – charchar (16 bit)(16 bit) – booleanboolean (true / false)(true / false)
  • 13. 13 Reference Data TypesReference Data Types • Examples:Examples: – ArraysArrays – StringsStrings – ObjectsObjects – InterfacesInterfaces • The name reference means a pointer in the memory. AllThe name reference means a pointer in the memory. All objects are referred by their memory location only. Butobjects are referred by their memory location only. But user cannot directly access memory location.user cannot directly access memory location. • Memory management is taken care by JVM itself.Memory management is taken care by JVM itself.
  • 14. 14 Variable NamesVariable Names • Variable names in Java are legal Java identifier comprisedVariable names in Java are legal Java identifier comprised of a series of Unicode characters.of a series of Unicode characters. • Variable names must not be Java keyword or a booleanVariable names must not be Java keyword or a boolean literalliteral • Same variable name should not appear twice within aSame variable name should not appear twice within a scope.scope.
  • 15. 15 Java OperatorsJava Operators • Arithmetic OperatorsArithmetic Operators +, -, *, /, %+, -, *, /, % • Unary Arithmetic OperatorsUnary Arithmetic Operators ++, --++, -- • Relational and Conditional OperatorsRelational and Conditional Operators >, >=, <, <=, ==, !=, &&, ||, !>, >=, <, <=, ==, !=, &&, ||, ! • Bitwise OperatorsBitwise Operators >>, <<, >>>, &, |, ^, ~>>, <<, >>>, &, |, ^, ~ • Ternary Operator: ()?():()Ternary Operator: ()?():()
  • 16. 16 Control FlowControl Flow • Decision makingDecision making – if-else, switch-caseif-else, switch-case • LoopLoop – for, while, do-whilefor, while, do-while • ExceptionException – try-catch-finally, throwtry-catch-finally, throw • MiscellaneousMiscellaneous – Break, continue, label:, returnBreak, continue, label:, return
  • 17. 17 Arrays in JavaArrays in Java • Java arrays are objects.Java arrays are objects. • Array contains like-typed values.Array contains like-typed values. • Array can contain both primitive and reference data types.Array can contain both primitive and reference data types. • When used with reference data types, reference (memoryWhen used with reference data types, reference (memory location) is only stored in arrays and not the real objects.location) is only stored in arrays and not the real objects. • Java supports multidimensional arrays. They are nothingJava supports multidimensional arrays. They are nothing but ‘array of arrays’.but ‘array of arrays’.
  • 18. 18 Arrays in JavaArrays in Java • Array DeclarationArray Declaration – int myIntegers[];int myIntegers[]; – int[] myIntegers;int[] myIntegers; • Array memory allocation:Array memory allocation: – int myIntegers[] = new int[10];int myIntegers[] = new int[10]; • Array Initialization:Array Initialization: – int myIntegers[] = {1,2,3,4,5};int myIntegers[] = {1,2,3,4,5};
  • 19. 19 Strings in JavaStrings in Java • A sequence of characters is encapsulated as a StringA sequence of characters is encapsulated as a String object.object. • Java uses ‘+’ operator for String concatenation.Java uses ‘+’ operator for String concatenation. • Some useful String functions are:Some useful String functions are: – s.length();s.length(); – s1.equals(s2);s1.equals(s2); – s1.subString(int startIndex, int upTo);s1.subString(int startIndex, int upTo);
  • 20. 20 SummarySummary • In this session you learned about:In this session you learned about: – Java Programming LanguageJava Programming Language – Java PlatformJava Platform – Java EnvironmentJava Environment – First Java ProgramFirst Java Program – Data TypesData Types – OperatorsOperators – Control FlowControl Flow – Java Arrays and StringsJava Arrays and Strings

Editor's Notes

  1. Java is an object oriented programming language similar to C++. It is a high level programming language. Platform mean Java runs on a virtual machine. Normally, programs are compiled and built for a specific architecture and operating system. Since Java needs to run on different OS a virtual platform is used on the top of default operating system.
  2. JVM and Java API together is called Java Runtime Environment (JRE)
  3. Java Runtime Environment (JRE)
  4. Name of the public class if the file contains more than one class, becomes the name of the file with “.java” extension
  5. Primitive data types: Because java program has to run on different architecture and OS, the size of the data should remain same. Otherwise, on different machines the output will be different. Refere
  6. Interfaces acts like alias for objects. Interface are taught later.
  7. Unicode is an unique number that is given to every character which works on any platform, any language and any hardware. It facilitates the display of any national characers on any of the browsers. All the popular current browsers supports this unicode system