SlideShare uma empresa Scribd logo
1 de 6
Chapter 2: Creating a Java Application and Applet 1
Using TextPad
• TextPad has several window areas
– Coding window
– Selector window
– Clip Library window
• TextPad can display line numbers
– Helpful for finding compiler errors
• TextPad has color-coding capabilities
– Save a document before entering code to
enable Java related color-coding
Chapter 2: Creating a Java Application and Applet 2
Coding the Program -
Comments as Documentation
• Purpose of comments
– Provides clear description when reviewing code
– Helps programmer think clearly when coding
• Placement of comments
– Use a comment header to identify a file and its
purpose
– Place a comment at the beginning of code for each
event and method
– Place comments near portions of code that need
clarification
Chapter 2: Creating a Java Application and Applet 3
Coding the Program -
The Class Header
• Identify how the code can be accessed with an
access modifier
– public indicates that the code can be accessed by all
objects in the program and can be extended for a
subclass
• Specify a unique name for the class
– The class name at the beginning of the program must
match the file name exactly
– Java is case-sensitive
– By convention, uppercase letters are used for class
names and to distinguish words in class names
Chapter 2: Creating a Java Application and Applet 4
Coding the Program -
The Class Header
• Use braces {} after the class header to enclose
the class body
Chapter 2: Creating a Java Application and Applet 5
Coding the Program -
The Method Header
• The method header contains modifiers, return value,
method name, and parameters along with their data type
• Every stand-alone Java application must contain a
main() method, which is the starting point during
execution
Chapter 2: Creating a Java Application and Applet 6
Coding the Program -
The Method Header
• Modifiers set properties for a method
– public allows other programs to invoke this method
– static means this method is unique and can be
invoked with creating an instance
• Parameters are pieces of data received by the
method to help the method perform its operation
– Identifiers are used to name the variable sent to the
method
• Return type is the data type of the data returned
by the method
– If no data is returned, the keyword void is used

Mais conteúdo relacionado

Mais procurados (19)

Ppt chapter09
Ppt chapter09Ppt chapter09
Ppt chapter09
 
Pptchapter04
Pptchapter04Pptchapter04
Pptchapter04
 
Lecture 8 Library classes
Lecture 8 Library classesLecture 8 Library classes
Lecture 8 Library classes
 
Abap object-oriented-programming-tutorials
Abap object-oriented-programming-tutorialsAbap object-oriented-programming-tutorials
Abap object-oriented-programming-tutorials
 
Basics of Java
Basics of JavaBasics of Java
Basics of Java
 
Oo abap-sap-1206973306636228-5
Oo abap-sap-1206973306636228-5Oo abap-sap-1206973306636228-5
Oo abap-sap-1206973306636228-5
 
17515
1751517515
17515
 
Java interfaces
Java interfacesJava interfaces
Java interfaces
 
Towards Improving Interface Modularity in Legacy Java Software Through Automa...
Towards Improving Interface Modularity in Legacy Java Software Through Automa...Towards Improving Interface Modularity in Legacy Java Software Through Automa...
Towards Improving Interface Modularity in Legacy Java Software Through Automa...
 
java interface and packages
java interface and packagesjava interface and packages
java interface and packages
 
Java interfaces
Java   interfacesJava   interfaces
Java interfaces
 
Java interfaces
Java interfacesJava interfaces
Java interfaces
 
Lecture13 abap on line
Lecture13 abap on lineLecture13 abap on line
Lecture13 abap on line
 
Chapter 2 - Basic Elements of Java
Chapter 2 - Basic Elements of JavaChapter 2 - Basic Elements of Java
Chapter 2 - Basic Elements of Java
 
CIS 1403 lab 3 functions and methods in Java
CIS 1403 lab 3 functions and methods in JavaCIS 1403 lab 3 functions and methods in Java
CIS 1403 lab 3 functions and methods in Java
 
9781111530532 ppt ch10
9781111530532 ppt ch109781111530532 ppt ch10
9781111530532 ppt ch10
 
Interfaces in java
Interfaces in javaInterfaces in java
Interfaces in java
 
SAP ABAP using OOPS - JH Softech
SAP ABAP using OOPS - JH SoftechSAP ABAP using OOPS - JH Softech
SAP ABAP using OOPS - JH Softech
 
C# interview
C# interviewC# interview
C# interview
 

Semelhante a Class method

Semelhante a Class method (20)

Java annotations
Java annotationsJava annotations
Java annotations
 
Java
JavaJava
Java
 
Java notes
Java notesJava notes
Java notes
 
The Java Learning Kit Chapter 5 – Methods and Modular.docx
The Java Learning Kit Chapter 5 – Methods and Modular.docxThe Java Learning Kit Chapter 5 – Methods and Modular.docx
The Java Learning Kit Chapter 5 – Methods and Modular.docx
 
OOPSCA1.pptx
OOPSCA1.pptxOOPSCA1.pptx
OOPSCA1.pptx
 
A-Brief-Introduction-To-JAVA8_By_Srimanta_Sahu
A-Brief-Introduction-To-JAVA8_By_Srimanta_SahuA-Brief-Introduction-To-JAVA8_By_Srimanta_Sahu
A-Brief-Introduction-To-JAVA8_By_Srimanta_Sahu
 
Concurrency Programming in Java - 02 - Essentials of Java Part 1
Concurrency Programming in Java - 02 - Essentials of Java Part 1Concurrency Programming in Java - 02 - Essentials of Java Part 1
Concurrency Programming in Java - 02 - Essentials of Java Part 1
 
core_java.ppt
core_java.pptcore_java.ppt
core_java.ppt
 
Core java-introduction
Core java-introductionCore java-introduction
Core java-introduction
 
Introduction to Java Programming
Introduction to Java Programming Introduction to Java Programming
Introduction to Java Programming
 
Java Programming Fundamentals
Java Programming Fundamentals Java Programming Fundamentals
Java Programming Fundamentals
 
Java
JavaJava
Java
 
The smartpath information systems c plus plus
The smartpath information systems  c plus plusThe smartpath information systems  c plus plus
The smartpath information systems c plus plus
 
Learn Java with Dr. Rifat Shahriyar
Learn Java with Dr. Rifat ShahriyarLearn Java with Dr. Rifat Shahriyar
Learn Java with Dr. Rifat Shahriyar
 
Learnadvancedjavaprogramming 131217055604-phpapp02
Learnadvancedjavaprogramming 131217055604-phpapp02Learnadvancedjavaprogramming 131217055604-phpapp02
Learnadvancedjavaprogramming 131217055604-phpapp02
 
Chap1 packages
Chap1 packagesChap1 packages
Chap1 packages
 
01slide (1)ffgfefge
01slide (1)ffgfefge01slide (1)ffgfefge
01slide (1)ffgfefge
 
TypeScript Overview
TypeScript OverviewTypeScript Overview
TypeScript Overview
 
Basics of java 2
Basics of java 2Basics of java 2
Basics of java 2
 
01slide
01slide01slide
01slide
 

Mais de Richard Styner

Mais de Richard Styner (16)

OneNote for Students.pptx
OneNote for Students.pptxOneNote for Students.pptx
OneNote for Students.pptx
 
Hopscotch.docx
Hopscotch.docxHopscotch.docx
Hopscotch.docx
 
Lit Review + Case Study (1).docx
Lit Review + Case Study (1).docxLit Review + Case Study (1).docx
Lit Review + Case Study (1).docx
 
udlspace.docx
udlspace.docxudlspace.docx
udlspace.docx
 
Documentary Video UDL Lesson.docx
Documentary Video UDL Lesson.docxDocumentary Video UDL Lesson.docx
Documentary Video UDL Lesson.docx
 
rubric.docx
rubric.docxrubric.docx
rubric.docx
 
Ppt chapter04
Ppt chapter04Ppt chapter04
Ppt chapter04
 
Ppt chapter03
Ppt chapter03Ppt chapter03
Ppt chapter03
 
Ppt chapter01
Ppt chapter01Ppt chapter01
Ppt chapter01
 
Ppt chapter08
Ppt chapter08Ppt chapter08
Ppt chapter08
 
Richard Styner Issues and trends
Richard Styner Issues and trendsRichard Styner Issues and trends
Richard Styner Issues and trends
 
Ppt chapter 01
Ppt chapter 01Ppt chapter 01
Ppt chapter 01
 
Tech mentoring project presentation
Tech mentoring project presentationTech mentoring project presentation
Tech mentoring project presentation
 
The Photoshop Effect
The Photoshop EffectThe Photoshop Effect
The Photoshop Effect
 
Stanford Solar Center Joint Curriculum
Stanford Solar Center Joint CurriculumStanford Solar Center Joint Curriculum
Stanford Solar Center Joint Curriculum
 
The Stanford Solar Lab
The Stanford Solar Lab The Stanford Solar Lab
The Stanford Solar Lab
 

Último

Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17Celine George
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxPooja Bhuva
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxPooja Bhuva
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...Amil baba
 

Último (20)

Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 

Class method

  • 1. Chapter 2: Creating a Java Application and Applet 1 Using TextPad • TextPad has several window areas – Coding window – Selector window – Clip Library window • TextPad can display line numbers – Helpful for finding compiler errors • TextPad has color-coding capabilities – Save a document before entering code to enable Java related color-coding
  • 2. Chapter 2: Creating a Java Application and Applet 2 Coding the Program - Comments as Documentation • Purpose of comments – Provides clear description when reviewing code – Helps programmer think clearly when coding • Placement of comments – Use a comment header to identify a file and its purpose – Place a comment at the beginning of code for each event and method – Place comments near portions of code that need clarification
  • 3. Chapter 2: Creating a Java Application and Applet 3 Coding the Program - The Class Header • Identify how the code can be accessed with an access modifier – public indicates that the code can be accessed by all objects in the program and can be extended for a subclass • Specify a unique name for the class – The class name at the beginning of the program must match the file name exactly – Java is case-sensitive – By convention, uppercase letters are used for class names and to distinguish words in class names
  • 4. Chapter 2: Creating a Java Application and Applet 4 Coding the Program - The Class Header • Use braces {} after the class header to enclose the class body
  • 5. Chapter 2: Creating a Java Application and Applet 5 Coding the Program - The Method Header • The method header contains modifiers, return value, method name, and parameters along with their data type • Every stand-alone Java application must contain a main() method, which is the starting point during execution
  • 6. Chapter 2: Creating a Java Application and Applet 6 Coding the Program - The Method Header • Modifiers set properties for a method – public allows other programs to invoke this method – static means this method is unique and can be invoked with creating an instance • Parameters are pieces of data received by the method to help the method perform its operation – Identifiers are used to name the variable sent to the method • Return type is the data type of the data returned by the method – If no data is returned, the keyword void is used