SlideShare a Scribd company logo
Chapter 1 Introducing Java
Objectives   Recognize the strengths of the Java programming language. Understand the uses of Java for applets and applications. Use the  import  statement to incorporate Java packages into your code. Declare and add components to an interface. Modify text using the Color and Font objects. Write an applet and run it in a browser or applet viewer.
Java   You can write small programs called applets, which run in a Web browser. You can write stand-alone programs called applications, which are independent of the browser. Programs can be text based or have graphical user interface (GUI). Developed by Sun Microsystems in 1991.
An Official Description Java is a simple, object-oriented, robust, secure, portable, high-performance, architecturally neutral, interpreted, multithreaded, dynamic language.
Object Oriented Java is a true object oriented programming language (OOP). In OOP, programmers create units called classes that contain data and the instructions for handling data.  Well-designed classes are reusable components that can be combined to create new applications.
Object Oriented  Continued Applets running in a browser and GUI applications do not follow a sequential logic. Each user action can cause an event to occur, which can trigger an event handler. The clicking causes the event listener to notify your program, and the program automatically jumps to a procedure you have written to do the event.
Traditional Languages are Compiled
Java Applets and Applications are Compiled
Java Development Tools To run a Java program, you need the Java Runtime Environment (JRE). To develop or write Java applications and applets you need the  Java Development Kit (JDK)  from Sun Microsystems.
The Java API The Java  application programming interface (API)  consists of classes created by Sun Microsystems and stored in library files called  packages . We use classes from java.lang, java.awt, java.applet. For the other classes see table on next slide.
Partial List of Core Java API Packages   Core functions of the language, automatically included java.lang Handle input and output of data java.io Create software components java.beans Graphical components using abstract windows toolkit java.awt Create applets java.applet Purpose Package
Partial List of Core Java API Packages  Continued Purpose Package Provide utilities such as dates java.util Manipulate text including searches java.text GUI using Java Foundation Classes java.swing Query databases java.sql Manage certificates, signatures, and other security java.security Remote objects java.rmi Networking java.net Handle math functions, very large integers and decimal values java.math
Java has Several Levels of Security
Classes and Objects A class is a template or blueprint for an object, but is not the object itself. Let us take an example of a dog: We can describe the characteristics of a certain breed of dog, such as typical coloring and general size and whether the breed barks, bites, or runs fast and descriptions are the properties and methods of the class. But an actual dog (an  instance  of the dog class) will have a set of characteristics, such as a name and a size. This means you instantiate object of the dog class to create an instance of the dog.
Java Objects   In Java, all objects are inherited from the Object class from the lang package (java.lang.Object). The Object class is the  superclass  of all other classes, which are called  subclasses . See Fig 1.6 for the inheritance of the applet class, which inherits from the Panel class, which inherits from the Container class, which inherits from the Component, which inherits from the Object.
Inheritance of Java Objects
Inheritance   An important concept of OOP is  inheritance . The new class is based on an existing class. In Java, we say that the new class  extends  or  inherits  from the existing class.
Encapsulation   Another important concept of OOP is encapsulation. Encapsulation refers to the combination of characteristics of a class. Encapsulation is often referred to as  data hiding . The class can "expose" certain properties and methods and keep others hidden.
Punctuation   Java is very picky about punctuation. Every statement must be terminated by a  semicolon  (;). The  braces  ({}) enclose a  block  of statements. The applet class contains a block of statements and the method inside the class contains another block.
Case Sensitivity   Java is case-sensitive, so it is critical that you observe the capitalization. Most errors on first programs are due to incorrect capitalization.
Class Diagram
Naming Rules   A Java name: must contain only letters, numbers, and underscores. must begin with a letter or underscore. cannot have any embedded spaces. is case sensitive. Cannot be one of Java's reserved words, such as  boolean ,  public , or  import . (Note that all of the Java reserved words are lowercase. If you use uppercase as part of your names, you will never have a naming conflict.
Naming Conventions   To create good Java names, you should: Make all names meaningful. Do not use names such as a, b, c, or x. Always create names that a person reading your code can tell the purpose of. And do not abbreviate unless using a standard abbreviation that has a clearly understood meaning. Begin the name with a lowercase prefix that indicates the type of component.
Naming Conventions  Continued Begin the actual name (following the prefix) with an uppercase letter. Use mixed upper- and lowercase for the name, with a capital to begin each new word. Examples lblMessage fntLargeText
Finding and Fixing Errors   Programming errors come in three varieties: compile errors, run-time errors and logic errors.
Using HTML to Run the Applet in a Browser   To run your applet in a browser, you need to create an HTML file that calls the applet, and then open the HTML file with the browser. You can set the width and height to the value of your choice, and then omit the resize method in your applet.  <HTML> <BODY> <Applet code = FontApplet.class  width = 600  height = 200> </Applet> </BODY> </HTML>
Using HTML to Run the Applet in a Browser Continued The codes in HTML tags < > are not case sensitive, but the name of the class file  is  case sensitive. Your Java source code file has a .java extension and after  the compiler completes, it creates the .class file. Follow the applet information with the closing tag </Applet>.
Life Cycle of an Applet   The execution of an applet in a browser follows a specific cycle. Each applet always executes four methods:  init, start, stop , and  destroy. The only method you are writing currently is the  init  method.
The Methods in the Life Cycle of an Applet   Executes prior to shut down of the browser destroy Executes when the browser leaves a Web page containing the applet stop Follows the init and reexecutes each time that the page displays start Executes the first time an applet is loaded init Purpose Method
Class Diagram
Ad

More Related Content

What's hot (20)

Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & Languages
Gaditek
 
Dart presentation
Dart presentationDart presentation
Dart presentation
Lucas Leal
 
Let's Play Dart
Let's Play DartLet's Play Dart
Let's Play Dart
Jana Moudrá
 
C sharp
C sharpC sharp
C sharp
Satish Verma
 
Introduction to c++ ppt 1
Introduction to c++ ppt 1Introduction to c++ ppt 1
Introduction to c++ ppt 1
Prof. Dr. K. Adisesha
 
Chapter 2 c#
Chapter 2 c#Chapter 2 c#
Chapter 2 c#
megersaoljira
 
Java platform
Java platformJava platform
Java platform
BG Java EE Course
 
Python for katana
Python for katanaPython for katana
Python for katana
kedar nath
 
C++ Object Oriented Programming
C++  Object Oriented ProgrammingC++  Object Oriented Programming
C++ Object Oriented Programming
Gamindu Udayanga
 
Common Programming Paradigms
Common Programming ParadigmsCommon Programming Paradigms
Common Programming Paradigms
Suheyl Zafar
 
From DOT to Dotty
From DOT to DottyFrom DOT to Dotty
From DOT to Dotty
Martin Odersky
 
Maths&programming forartists wip
Maths&programming forartists wipMaths&programming forartists wip
Maths&programming forartists wip
kedar nath
 
Groovy Programming Language
Groovy Programming LanguageGroovy Programming Language
Groovy Programming Language
Aniruddha Chakrabarti
 
Mel for beginners
Mel for beginnersMel for beginners
Mel for beginners
kedar nath
 
C# - Part 1
C# - Part 1C# - Part 1
C# - Part 1
Md. Mahedee Hasan
 
File handling & regular expressions in python programming
File handling & regular expressions in python programmingFile handling & regular expressions in python programming
File handling & regular expressions in python programming
Srinivas Narasegouda
 
Domain-Specific Languages
Domain-Specific LanguagesDomain-Specific Languages
Domain-Specific Languages
Javier Canovas
 
C++ Programming Course
C++ Programming CourseC++ Programming Course
C++ Programming Course
Dennis Chang
 
Dart programming tutorial
Dart programming tutorialDart programming tutorial
Dart programming tutorial
HarikaReddy115
 
Implementing Higher-Kinded Types in Dotty
Implementing Higher-Kinded Types in DottyImplementing Higher-Kinded Types in Dotty
Implementing Higher-Kinded Types in Dotty
Martin Odersky
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & Languages
Gaditek
 
Dart presentation
Dart presentationDart presentation
Dart presentation
Lucas Leal
 
Python for katana
Python for katanaPython for katana
Python for katana
kedar nath
 
C++ Object Oriented Programming
C++  Object Oriented ProgrammingC++  Object Oriented Programming
C++ Object Oriented Programming
Gamindu Udayanga
 
Common Programming Paradigms
Common Programming ParadigmsCommon Programming Paradigms
Common Programming Paradigms
Suheyl Zafar
 
Maths&programming forartists wip
Maths&programming forartists wipMaths&programming forartists wip
Maths&programming forartists wip
kedar nath
 
Mel for beginners
Mel for beginnersMel for beginners
Mel for beginners
kedar nath
 
File handling & regular expressions in python programming
File handling & regular expressions in python programmingFile handling & regular expressions in python programming
File handling & regular expressions in python programming
Srinivas Narasegouda
 
Domain-Specific Languages
Domain-Specific LanguagesDomain-Specific Languages
Domain-Specific Languages
Javier Canovas
 
C++ Programming Course
C++ Programming CourseC++ Programming Course
C++ Programming Course
Dennis Chang
 
Dart programming tutorial
Dart programming tutorialDart programming tutorial
Dart programming tutorial
HarikaReddy115
 
Implementing Higher-Kinded Types in Dotty
Implementing Higher-Kinded Types in DottyImplementing Higher-Kinded Types in Dotty
Implementing Higher-Kinded Types in Dotty
Martin Odersky
 

Viewers also liked (17)

SUCCESS Pro-Career Connect presentation
SUCCESS Pro-Career Connect presentationSUCCESS Pro-Career Connect presentation
SUCCESS Pro-Career Connect presentation
mcbyue
 
Why Blogs and Social Media are Effective Marketing Tools
Why Blogs and Social Media are Effective Marketing ToolsWhy Blogs and Social Media are Effective Marketing Tools
Why Blogs and Social Media are Effective Marketing Tools
Miriam Schwab
 
Carros Sujos
Carros SujosCarros Sujos
Carros Sujos
J. C.
 
Deng Nai Rong Paintings
Deng Nai Rong PaintingsDeng Nai Rong Paintings
Deng Nai Rong Paintings
cleeyy
 
tutorial del youtube
tutorial del youtubetutorial del youtube
tutorial del youtube
carlitos albarran
 
Primer Trimestre
Primer TrimestrePrimer Trimestre
Primer Trimestre
aegalan
 
Estaciones de Trenes en Rosario Hoy
Estaciones de Trenes en Rosario HoyEstaciones de Trenes en Rosario Hoy
Estaciones de Trenes en Rosario Hoy
acarrieres1
 
Whales
WhalesWhales
Whales
rredmond
 
Redes Aurales - Mediateletipos.net
Redes Aurales - Mediateletipos.netRedes Aurales - Mediateletipos.net
Redes Aurales - Mediateletipos.net
Pedro Jimenez
 
Presentatie Doorbreek De Stilte
Presentatie Doorbreek De StiltePresentatie Doorbreek De Stilte
Presentatie Doorbreek De Stilte
sjannie
 
Definiciones
Definiciones Definiciones
Definiciones
tatu
 
Officenet Plus - Qué es
Officenet Plus - Qué esOfficenet Plus - Qué es
Officenet Plus - Qué es
Leo Piccioli
 
Cult Maroon 5
Cult Maroon 5Cult Maroon 5
Cult Maroon 5
Doris Soares
 
Chris Barger Social Media Presentation
Chris Barger Social Media PresentationChris Barger Social Media Presentation
Chris Barger Social Media Presentation
ashleymattingly
 
Chapter2pp
Chapter2ppChapter2pp
Chapter2pp
J. C.
 
Modelo de compras de software
Modelo de compras de softwareModelo de compras de software
Modelo de compras de software
J. C.
 
SUCCESS Pro-Career Connect presentation
SUCCESS Pro-Career Connect presentationSUCCESS Pro-Career Connect presentation
SUCCESS Pro-Career Connect presentation
mcbyue
 
Why Blogs and Social Media are Effective Marketing Tools
Why Blogs and Social Media are Effective Marketing ToolsWhy Blogs and Social Media are Effective Marketing Tools
Why Blogs and Social Media are Effective Marketing Tools
Miriam Schwab
 
Carros Sujos
Carros SujosCarros Sujos
Carros Sujos
J. C.
 
Deng Nai Rong Paintings
Deng Nai Rong PaintingsDeng Nai Rong Paintings
Deng Nai Rong Paintings
cleeyy
 
Primer Trimestre
Primer TrimestrePrimer Trimestre
Primer Trimestre
aegalan
 
Estaciones de Trenes en Rosario Hoy
Estaciones de Trenes en Rosario HoyEstaciones de Trenes en Rosario Hoy
Estaciones de Trenes en Rosario Hoy
acarrieres1
 
Redes Aurales - Mediateletipos.net
Redes Aurales - Mediateletipos.netRedes Aurales - Mediateletipos.net
Redes Aurales - Mediateletipos.net
Pedro Jimenez
 
Presentatie Doorbreek De Stilte
Presentatie Doorbreek De StiltePresentatie Doorbreek De Stilte
Presentatie Doorbreek De Stilte
sjannie
 
Definiciones
Definiciones Definiciones
Definiciones
tatu
 
Officenet Plus - Qué es
Officenet Plus - Qué esOfficenet Plus - Qué es
Officenet Plus - Qué es
Leo Piccioli
 
Chris Barger Social Media Presentation
Chris Barger Social Media PresentationChris Barger Social Media Presentation
Chris Barger Social Media Presentation
ashleymattingly
 
Chapter2pp
Chapter2ppChapter2pp
Chapter2pp
J. C.
 
Modelo de compras de software
Modelo de compras de softwareModelo de compras de software
Modelo de compras de software
J. C.
 
Ad

Similar to Chapter1pp (20)

01slide
01slide01slide
01slide
Usha Sri
 
01slide
01slide01slide
01slide
cdclabs_123
 
Classes and Objects
Classes and ObjectsClasses and Objects
Classes and Objects
vmadan89
 
Unit of competency
Unit of competencyUnit of competency
Unit of competency
loidasacueza
 
Basics of java 1
Basics of java 1Basics of java 1
Basics of java 1
Vijay Kankane
 
Mastering Java Terminologies_ Essential Concepts for Beginners.pdf
Mastering Java Terminologies_ Essential Concepts for Beginners.pdfMastering Java Terminologies_ Essential Concepts for Beginners.pdf
Mastering Java Terminologies_ Essential Concepts for Beginners.pdf
CodeYoung
 
Java for Mainframers
Java for MainframersJava for Mainframers
Java for Mainframers
Rich Helton
 
OOPM Introduction.ppt
OOPM Introduction.pptOOPM Introduction.ppt
OOPM Introduction.ppt
vijay251387
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
Veerabadra Badra
 
Java1
Java1Java1
Java1
computertuitions
 
Java
Java Java
Java
computertuitions
 
Top 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdfTop 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdf
Umesh Kumar
 
Unit1 introduction to Java
Unit1 introduction to JavaUnit1 introduction to Java
Unit1 introduction to Java
DevaKumari Vijay
 
Object Oriented Programming unit 1 content for students
Object Oriented Programming unit 1 content for studentsObject Oriented Programming unit 1 content for students
Object Oriented Programming unit 1 content for students
ASHASITTeaching
 
Java interview questions and answers
Java interview questions and answersJava interview questions and answers
Java interview questions and answers
Krishnaov
 
DAY_1.1.pptx
DAY_1.1.pptxDAY_1.1.pptx
DAY_1.1.pptx
ishasharma835109
 
Introduction
IntroductionIntroduction
Introduction
richsoden
 
Java
JavaJava
Java
Sneha Mudraje
 
Chapter 2.1
Chapter 2.1Chapter 2.1
Chapter 2.1
sotlsoc
 
Unit 1 – Introduction to Java- (Shilpa R).pptx
Unit 1 – Introduction to Java- (Shilpa R).pptxUnit 1 – Introduction to Java- (Shilpa R).pptx
Unit 1 – Introduction to Java- (Shilpa R).pptx
shilpar780389
 
Classes and Objects
Classes and ObjectsClasses and Objects
Classes and Objects
vmadan89
 
Unit of competency
Unit of competencyUnit of competency
Unit of competency
loidasacueza
 
Mastering Java Terminologies_ Essential Concepts for Beginners.pdf
Mastering Java Terminologies_ Essential Concepts for Beginners.pdfMastering Java Terminologies_ Essential Concepts for Beginners.pdf
Mastering Java Terminologies_ Essential Concepts for Beginners.pdf
CodeYoung
 
Java for Mainframers
Java for MainframersJava for Mainframers
Java for Mainframers
Rich Helton
 
OOPM Introduction.ppt
OOPM Introduction.pptOOPM Introduction.ppt
OOPM Introduction.ppt
vijay251387
 
Top 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdfTop 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdf
Umesh Kumar
 
Unit1 introduction to Java
Unit1 introduction to JavaUnit1 introduction to Java
Unit1 introduction to Java
DevaKumari Vijay
 
Object Oriented Programming unit 1 content for students
Object Oriented Programming unit 1 content for studentsObject Oriented Programming unit 1 content for students
Object Oriented Programming unit 1 content for students
ASHASITTeaching
 
Java interview questions and answers
Java interview questions and answersJava interview questions and answers
Java interview questions and answers
Krishnaov
 
Introduction
IntroductionIntroduction
Introduction
richsoden
 
Chapter 2.1
Chapter 2.1Chapter 2.1
Chapter 2.1
sotlsoc
 
Unit 1 – Introduction to Java- (Shilpa R).pptx
Unit 1 – Introduction to Java- (Shilpa R).pptxUnit 1 – Introduction to Java- (Shilpa R).pptx
Unit 1 – Introduction to Java- (Shilpa R).pptx
shilpar780389
 
Ad

More from J. C. (20)

Apresentação processos e objetivos da alfabetização ciman 2013
Apresentação   processos e objetivos da alfabetização ciman  2013Apresentação   processos e objetivos da alfabetização ciman  2013
Apresentação processos e objetivos da alfabetização ciman 2013
J. C.
 
Uso de tecnologias
Uso de tecnologiasUso de tecnologias
Uso de tecnologias
J. C.
 
Tecnologias na educacao
Tecnologias na educacaoTecnologias na educacao
Tecnologias na educacao
J. C.
 
Pais maus
Pais mausPais maus
Pais maus
J. C.
 
A perícia médica a ética e a relação
A perícia médica a ética e a relaçãoA perícia médica a ética e a relação
A perícia médica a ética e a relação
J. C.
 
Quero
QueroQuero
Quero
J. C.
 
Pequeno prncipe
Pequeno prncipePequeno prncipe
Pequeno prncipe
J. C.
 
Ni
NiNi
Ni
J. C.
 
Meuanivers rio
Meuanivers rioMeuanivers rio
Meuanivers rio
J. C.
 
Sejascout
SejascoutSejascout
Sejascout
J. C.
 
Cartilha00
Cartilha00Cartilha00
Cartilha00
J. C.
 
Cartilha00
Cartilha00Cartilha00
Cartilha00
J. C.
 
Amor
AmorAmor
Amor
J. C.
 
Fotos gincana
Fotos gincanaFotos gincana
Fotos gincana
J. C.
 
Processo E Objetivos Da Alfabetização
Processo E Objetivos Da AlfabetizaçãoProcesso E Objetivos Da Alfabetização
Processo E Objetivos Da Alfabetização
J. C.
 
Fotografías
FotografíasFotografías
Fotografías
J. C.
 
Fotografías
FotografíasFotografías
Fotografías
J. C.
 
A Alma Da Mulher
A Alma Da MulherA Alma Da Mulher
A Alma Da Mulher
J. C.
 
Colegas de trabalho
Colegas de trabalhoColegas de trabalho
Colegas de trabalho
J. C.
 
Bem Vindo Ao Escoteiro
Bem Vindo Ao EscoteiroBem Vindo Ao Escoteiro
Bem Vindo Ao Escoteiro
J. C.
 
Apresentação processos e objetivos da alfabetização ciman 2013
Apresentação   processos e objetivos da alfabetização ciman  2013Apresentação   processos e objetivos da alfabetização ciman  2013
Apresentação processos e objetivos da alfabetização ciman 2013
J. C.
 
Uso de tecnologias
Uso de tecnologiasUso de tecnologias
Uso de tecnologias
J. C.
 
Tecnologias na educacao
Tecnologias na educacaoTecnologias na educacao
Tecnologias na educacao
J. C.
 
Pais maus
Pais mausPais maus
Pais maus
J. C.
 
A perícia médica a ética e a relação
A perícia médica a ética e a relaçãoA perícia médica a ética e a relação
A perícia médica a ética e a relação
J. C.
 
Quero
QueroQuero
Quero
J. C.
 
Pequeno prncipe
Pequeno prncipePequeno prncipe
Pequeno prncipe
J. C.
 
Meuanivers rio
Meuanivers rioMeuanivers rio
Meuanivers rio
J. C.
 
Sejascout
SejascoutSejascout
Sejascout
J. C.
 
Cartilha00
Cartilha00Cartilha00
Cartilha00
J. C.
 
Cartilha00
Cartilha00Cartilha00
Cartilha00
J. C.
 
Amor
AmorAmor
Amor
J. C.
 
Fotos gincana
Fotos gincanaFotos gincana
Fotos gincana
J. C.
 
Processo E Objetivos Da Alfabetização
Processo E Objetivos Da AlfabetizaçãoProcesso E Objetivos Da Alfabetização
Processo E Objetivos Da Alfabetização
J. C.
 
Fotografías
FotografíasFotografías
Fotografías
J. C.
 
Fotografías
FotografíasFotografías
Fotografías
J. C.
 
A Alma Da Mulher
A Alma Da MulherA Alma Da Mulher
A Alma Da Mulher
J. C.
 
Colegas de trabalho
Colegas de trabalhoColegas de trabalho
Colegas de trabalho
J. C.
 
Bem Vindo Ao Escoteiro
Bem Vindo Ao EscoteiroBem Vindo Ao Escoteiro
Bem Vindo Ao Escoteiro
J. C.
 

Recently uploaded (20)

#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 

Chapter1pp

  • 2. Objectives Recognize the strengths of the Java programming language. Understand the uses of Java for applets and applications. Use the import statement to incorporate Java packages into your code. Declare and add components to an interface. Modify text using the Color and Font objects. Write an applet and run it in a browser or applet viewer.
  • 3. Java You can write small programs called applets, which run in a Web browser. You can write stand-alone programs called applications, which are independent of the browser. Programs can be text based or have graphical user interface (GUI). Developed by Sun Microsystems in 1991.
  • 4. An Official Description Java is a simple, object-oriented, robust, secure, portable, high-performance, architecturally neutral, interpreted, multithreaded, dynamic language.
  • 5. Object Oriented Java is a true object oriented programming language (OOP). In OOP, programmers create units called classes that contain data and the instructions for handling data. Well-designed classes are reusable components that can be combined to create new applications.
  • 6. Object Oriented Continued Applets running in a browser and GUI applications do not follow a sequential logic. Each user action can cause an event to occur, which can trigger an event handler. The clicking causes the event listener to notify your program, and the program automatically jumps to a procedure you have written to do the event.
  • 8. Java Applets and Applications are Compiled
  • 9. Java Development Tools To run a Java program, you need the Java Runtime Environment (JRE). To develop or write Java applications and applets you need the Java Development Kit (JDK) from Sun Microsystems.
  • 10. The Java API The Java application programming interface (API) consists of classes created by Sun Microsystems and stored in library files called packages . We use classes from java.lang, java.awt, java.applet. For the other classes see table on next slide.
  • 11. Partial List of Core Java API Packages Core functions of the language, automatically included java.lang Handle input and output of data java.io Create software components java.beans Graphical components using abstract windows toolkit java.awt Create applets java.applet Purpose Package
  • 12. Partial List of Core Java API Packages Continued Purpose Package Provide utilities such as dates java.util Manipulate text including searches java.text GUI using Java Foundation Classes java.swing Query databases java.sql Manage certificates, signatures, and other security java.security Remote objects java.rmi Networking java.net Handle math functions, very large integers and decimal values java.math
  • 13. Java has Several Levels of Security
  • 14. Classes and Objects A class is a template or blueprint for an object, but is not the object itself. Let us take an example of a dog: We can describe the characteristics of a certain breed of dog, such as typical coloring and general size and whether the breed barks, bites, or runs fast and descriptions are the properties and methods of the class. But an actual dog (an instance of the dog class) will have a set of characteristics, such as a name and a size. This means you instantiate object of the dog class to create an instance of the dog.
  • 15. Java Objects In Java, all objects are inherited from the Object class from the lang package (java.lang.Object). The Object class is the superclass of all other classes, which are called subclasses . See Fig 1.6 for the inheritance of the applet class, which inherits from the Panel class, which inherits from the Container class, which inherits from the Component, which inherits from the Object.
  • 17. Inheritance An important concept of OOP is inheritance . The new class is based on an existing class. In Java, we say that the new class extends or inherits from the existing class.
  • 18. Encapsulation Another important concept of OOP is encapsulation. Encapsulation refers to the combination of characteristics of a class. Encapsulation is often referred to as data hiding . The class can &quot;expose&quot; certain properties and methods and keep others hidden.
  • 19. Punctuation Java is very picky about punctuation. Every statement must be terminated by a semicolon (;). The braces ({}) enclose a block of statements. The applet class contains a block of statements and the method inside the class contains another block.
  • 20. Case Sensitivity Java is case-sensitive, so it is critical that you observe the capitalization. Most errors on first programs are due to incorrect capitalization.
  • 22. Naming Rules A Java name: must contain only letters, numbers, and underscores. must begin with a letter or underscore. cannot have any embedded spaces. is case sensitive. Cannot be one of Java's reserved words, such as boolean , public , or import . (Note that all of the Java reserved words are lowercase. If you use uppercase as part of your names, you will never have a naming conflict.
  • 23. Naming Conventions To create good Java names, you should: Make all names meaningful. Do not use names such as a, b, c, or x. Always create names that a person reading your code can tell the purpose of. And do not abbreviate unless using a standard abbreviation that has a clearly understood meaning. Begin the name with a lowercase prefix that indicates the type of component.
  • 24. Naming Conventions Continued Begin the actual name (following the prefix) with an uppercase letter. Use mixed upper- and lowercase for the name, with a capital to begin each new word. Examples lblMessage fntLargeText
  • 25. Finding and Fixing Errors Programming errors come in three varieties: compile errors, run-time errors and logic errors.
  • 26. Using HTML to Run the Applet in a Browser To run your applet in a browser, you need to create an HTML file that calls the applet, and then open the HTML file with the browser. You can set the width and height to the value of your choice, and then omit the resize method in your applet. <HTML> <BODY> <Applet code = FontApplet.class width = 600 height = 200> </Applet> </BODY> </HTML>
  • 27. Using HTML to Run the Applet in a Browser Continued The codes in HTML tags < > are not case sensitive, but the name of the class file is case sensitive. Your Java source code file has a .java extension and after the compiler completes, it creates the .class file. Follow the applet information with the closing tag </Applet>.
  • 28. Life Cycle of an Applet The execution of an applet in a browser follows a specific cycle. Each applet always executes four methods: init, start, stop , and destroy. The only method you are writing currently is the init method.
  • 29. The Methods in the Life Cycle of an Applet Executes prior to shut down of the browser destroy Executes when the browser leaves a Web page containing the applet stop Follows the init and reexecutes each time that the page displays start Executes the first time an applet is loaded init Purpose Method