SlideShare una empresa de Scribd logo
1 de 20
Descargar para leer sin conexión
3.1 Documentation &
Java Language Elements
3.1.1 Purpose of documentation

• Assist the programmer with developing
  the program
• Assist other programers who wish to use
  or modify the program
3.1.2 Guidelines for documenting classes
 • Block comments – Start with /* and end
   with */. Can occupy multiple lines
 • Single line comments – The line starts
   with //
3.1.3 The javadoc parameters
• The javadoc program can create HTML documents from
  the comments in the program’s source file
• To create javadoc comments,
  use /** and */
• Special tags can be imbedded in the comments
  @author, @version, @param, @return, etc
3.1.4 Java API documentation
3.1.5 Generating API docs for
classes using the javadoc tool
3.2.2 Keywords
• Keywords form the Java
  vocabulary
• The compiler is case-sensitive
3.2.3 Identifiers
• Labels assigned to data or storage
  addresses
• Rules for identifiers:
  – Any alphabetic character
  – First character must be a letter
  – Cannot contain space, % or #
  – Cannot be keywords
3.2.4 Use of braces, semicolons,
    commas, and white space
• A block is a collection of statements
  bounded by braces { }
• A statement consists of one or more lines
  of code, followed by a semicolon ;
• Commas are used to delineate data
• Whitespace is used to separate
  keywords and identifiers
3.3.1 Data storage introduction
• Registers – Memory in the CPU
• The Stack – Memory for methods and
  local variables
• The Heap – Memory to store objects
• Static – Stores data that will not change
  during the life of the program
• Constant – Values that never change.
3.4.1 Java language types
• Data type is the
  classification of
  forms of
  information
• Data type is
  declared using
  keywords
• Java is strongly
  typed
3.4.2 Java primitives

•   boolean – true or false
•   char – Stores a single UNICODE character
•   byte – Signed whole numbers from -127 to +128
•   short – Signed whole numbers from -32,768 to +32,767
•   int - Signed whole numbers from -231 to 231 -1
•   long – Signed whole numbers from -9x1018 to 9x1018 -1
•   float – Decimal values up to 6 – 7 decimal places
•   double – Decimal values up to 14 – 15 decimal places
3.4.3 Java references
• Objects are created in heap memory
• Programs use a variable that references
  the object
• The program
  acts on the
  object by using
  the reference
3.4.4 Data
• Object Data – Instance of a class, stored
  on the heap
• Static Class Data – Available before the
  object is created
• Local Data – Exists in methods, stored on
  the stack
• Constants – Data that will not change
• Variables – Holds a primitive or a
  reference to an object
3.4.4 Data (example)
public class Student
{
    private final String studentName;
    public static final int courseNumber = 12345;
    public String grade;

    public Student(String name, String grd) {
         studentName = name;
         grade = grd;
    }

    public void changeGrade(String grd) {
         grade = grd;
    }
                                            Try to Identify!!!!!
    public String getName() {               1. Object Data/Variable
         return studentName;
                                            2. Static Data/Variable
    }
}                                           3. Local Data/Variable
                                            4. Constants
3.5.2 Elements
• Class – Template or blueprint for object
  creation
• Method – A block of statements that
  control an object’s behavior
• Constructor – A special method that is
  called when the object is created
• Modifiers – private, public, protected,
  default, static, final
3.5.2 Elements
                public class Student
                {
                    private final String studentName;
                    public static final int courseNumber = 12345;
                    public String grade;

                    public Student(String name, String grd) {
                         studentName = name;
  constructor            grade = grd;
class               }

                    public void changeGrade(String grd) {
                         grade = grd;
 method             }

                    public String getName() {
                         return studentName;
                    }
                }
3.6.1 Five steps of object creation
•   Declaration of a reference variable
•   Default initialization
•   Explicit initialization
•   Execution of the constructor
•   Assignment of object’s address to
    reference variable
3.6.3 Mutability, Garbage
     Collection & Finalizers
• Most data is mutable, and can be
  changed. To make it immutable, use the
  final keyword
• Garbage collection frees up memory
  occupied by unused objects. This process
  cannot be controlled
• Every object inherits a finalizer method,
  that will be executed when the object is
  released
Individual activity & Lab Work
• Possible Lab Schedule every:
   – Monday, 15.00-16.50 or
   – Friday, 14.30 - 15.20 (PUSKOM-FTUI)
• TODO LIST (finished before next session):
   – Read through the online curriculum
   – Take the module exam 1 – 3 (Start: Thursday)
   – Do LABs:
      •   3.1.6.1 Insert Documentation for Classes in the JBANK Application
      •   3.1.6.2 Generate API Docs for JBANK Classes with the javadoc Tool
      •   3.5.1 Define Variables
      •   3.5.9 Apply Access Modifiers
      •   3.6.1 Use of Constructors
      •   3.8.1 Create the Classes for Phase I of the JBANK Application



     Note: Red bold color is obligatory to be submitted to ECourse System!

Más contenido relacionado

La actualidad más candente

Mutable and immutable classes
Mutable and  immutable classesMutable and  immutable classes
Mutable and immutable classesTech_MX
 
Java class,object,method introduction
Java class,object,method introductionJava class,object,method introduction
Java class,object,method introductionSohanur63
 
2 lesson 2 object oriented programming in c++
2 lesson 2 object oriented programming in c++2 lesson 2 object oriented programming in c++
2 lesson 2 object oriented programming in c++Jeff TUYISHIME
 
5. Inheritances, Packages and Intefaces
5. Inheritances, Packages and Intefaces5. Inheritances, Packages and Intefaces
5. Inheritances, Packages and IntefacesNilesh Dalvi
 
Inner Classes & Multi Threading in JAVA
Inner Classes & Multi Threading in JAVAInner Classes & Multi Threading in JAVA
Inner Classes & Multi Threading in JAVATech_MX
 
Python Class | Python Programming | Python Tutorial | Edureka
Python Class | Python Programming | Python Tutorial | EdurekaPython Class | Python Programming | Python Tutorial | Edureka
Python Class | Python Programming | Python Tutorial | EdurekaEdureka!
 
Classes and Nested Classes in Java
Classes and Nested Classes in JavaClasses and Nested Classes in Java
Classes and Nested Classes in JavaRavi_Kant_Sahu
 
[OOP - Lec 04,05] Basic Building Blocks of OOP
[OOP - Lec 04,05] Basic Building Blocks of OOP[OOP - Lec 04,05] Basic Building Blocks of OOP
[OOP - Lec 04,05] Basic Building Blocks of OOPMuhammad Hammad Waseem
 
Object Oriented Programming Concepts using Java
Object Oriented Programming Concepts using JavaObject Oriented Programming Concepts using Java
Object Oriented Programming Concepts using JavaGlenn Guden
 
Java Programming Paradigms Chapter 1
Java Programming Paradigms Chapter 1 Java Programming Paradigms Chapter 1
Java Programming Paradigms Chapter 1 Sakthi Durai
 
4. Classes and Methods
4. Classes and Methods4. Classes and Methods
4. Classes and MethodsNilesh Dalvi
 

La actualidad más candente (20)

Chap01
Chap01Chap01
Chap01
 
Mutable and immutable classes
Mutable and  immutable classesMutable and  immutable classes
Mutable and immutable classes
 
Java class,object,method introduction
Java class,object,method introductionJava class,object,method introduction
Java class,object,method introduction
 
27csharp
27csharp27csharp
27csharp
 
Unit 3
Unit 3Unit 3
Unit 3
 
2 lesson 2 object oriented programming in c++
2 lesson 2 object oriented programming in c++2 lesson 2 object oriented programming in c++
2 lesson 2 object oriented programming in c++
 
Classes and objects in c++
Classes and objects in c++Classes and objects in c++
Classes and objects in c++
 
Java static keyword
Java static keywordJava static keyword
Java static keyword
 
Classes and objects in java
Classes and objects in javaClasses and objects in java
Classes and objects in java
 
5. Inheritances, Packages and Intefaces
5. Inheritances, Packages and Intefaces5. Inheritances, Packages and Intefaces
5. Inheritances, Packages and Intefaces
 
[OOP - Lec 18] Static Data Member
[OOP - Lec 18] Static Data Member[OOP - Lec 18] Static Data Member
[OOP - Lec 18] Static Data Member
 
Inner Classes & Multi Threading in JAVA
Inner Classes & Multi Threading in JAVAInner Classes & Multi Threading in JAVA
Inner Classes & Multi Threading in JAVA
 
Python Class | Python Programming | Python Tutorial | Edureka
Python Class | Python Programming | Python Tutorial | EdurekaPython Class | Python Programming | Python Tutorial | Edureka
Python Class | Python Programming | Python Tutorial | Edureka
 
Classes and Nested Classes in Java
Classes and Nested Classes in JavaClasses and Nested Classes in Java
Classes and Nested Classes in Java
 
[OOP - Lec 04,05] Basic Building Blocks of OOP
[OOP - Lec 04,05] Basic Building Blocks of OOP[OOP - Lec 04,05] Basic Building Blocks of OOP
[OOP - Lec 04,05] Basic Building Blocks of OOP
 
Object Oriented Programming Concepts using Java
Object Oriented Programming Concepts using JavaObject Oriented Programming Concepts using Java
Object Oriented Programming Concepts using Java
 
Oops Concept Java
Oops Concept JavaOops Concept Java
Oops Concept Java
 
Java Programming Paradigms Chapter 1
Java Programming Paradigms Chapter 1 Java Programming Paradigms Chapter 1
Java Programming Paradigms Chapter 1
 
4. Classes and Methods
4. Classes and Methods4. Classes and Methods
4. Classes and Methods
 
Java2
Java2Java2
Java2
 

Destacado (6)

Chapter4
Chapter4Chapter4
Chapter4
 
Chapter1
Chapter1Chapter1
Chapter1
 
Chapter2 bag2
Chapter2 bag2Chapter2 bag2
Chapter2 bag2
 
Chapter3 bag1
Chapter3 bag1Chapter3 bag1
Chapter3 bag1
 
Chapter2 bag1
Chapter2 bag1Chapter2 bag1
Chapter2 bag1
 
Chapter1
Chapter1Chapter1
Chapter1
 

Similar a Chapter3 bag2

Refactoring bad codesmell
Refactoring bad codesmellRefactoring bad codesmell
Refactoring bad codesmellhyunglak kim
 
Modern Java - JFS - Stuttgart - 2023.pdf
Modern Java - JFS - Stuttgart - 2023.pdfModern Java - JFS - Stuttgart - 2023.pdf
Modern Java - JFS - Stuttgart - 2023.pdfRonVeen1
 
Modern Java - WeAreDevelopers - Berlin - 2023 - Ron Veen.pdf
Modern Java - WeAreDevelopers - Berlin - 2023  - Ron Veen.pdfModern Java - WeAreDevelopers - Berlin - 2023  - Ron Veen.pdf
Modern Java - WeAreDevelopers - Berlin - 2023 - Ron Veen.pdfRonVeen1
 
The programming philosophy of jrql
The programming philosophy of jrqlThe programming philosophy of jrql
The programming philosophy of jrqlmsg systems ag
 
Corejava Training in Bangalore Tutorial
Corejava Training in Bangalore TutorialCorejava Training in Bangalore Tutorial
Corejava Training in Bangalore Tutorialrajkamaltibacademy
 
Object-oriented Analysis, Design & Programming
Object-oriented Analysis, Design & ProgrammingObject-oriented Analysis, Design & Programming
Object-oriented Analysis, Design & ProgrammingAllan Mangune
 
Java cçccfftshrssfuutrfuuggiuffus201-java.ppt
Java cçccfftshrssfuutrfuuggiuffus201-java.pptJava cçccfftshrssfuutrfuuggiuffus201-java.ppt
Java cçccfftshrssfuutrfuuggiuffus201-java.pptscsankalp03
 
Pi j2.2 classes
Pi j2.2 classesPi j2.2 classes
Pi j2.2 classesmcollison
 
Object oriented programming in java
Object oriented programming in javaObject oriented programming in java
Object oriented programming in javaElizabeth alexander
 
static MEMBER IN OOPS PROGRAMING LANGUAGE.pptx
static MEMBER IN OOPS PROGRAMING LANGUAGE.pptxstatic MEMBER IN OOPS PROGRAMING LANGUAGE.pptx
static MEMBER IN OOPS PROGRAMING LANGUAGE.pptxurvashipundir04
 
static members in object oriented program.pptx
static members in object oriented program.pptxstatic members in object oriented program.pptx
static members in object oriented program.pptxurvashipundir04
 
Pi j2.3 objects
Pi j2.3 objectsPi j2.3 objects
Pi j2.3 objectsmcollison
 
Python Programming - VI. Classes and Objects
Python Programming - VI. Classes and ObjectsPython Programming - VI. Classes and Objects
Python Programming - VI. Classes and ObjectsRanel Padon
 
class as the basis.pptx
class as the basis.pptxclass as the basis.pptx
class as the basis.pptxEpsiba1
 

Similar a Chapter3 bag2 (20)

Oop concept
Oop conceptOop concept
Oop concept
 
VB.net&OOP.pptx
VB.net&OOP.pptxVB.net&OOP.pptx
VB.net&OOP.pptx
 
Refactoring bad codesmell
Refactoring bad codesmellRefactoring bad codesmell
Refactoring bad codesmell
 
Modern Java - JFS - Stuttgart - 2023.pdf
Modern Java - JFS - Stuttgart - 2023.pdfModern Java - JFS - Stuttgart - 2023.pdf
Modern Java - JFS - Stuttgart - 2023.pdf
 
Modern Java - WeAreDevelopers - Berlin - 2023 - Ron Veen.pdf
Modern Java - WeAreDevelopers - Berlin - 2023  - Ron Veen.pdfModern Java - WeAreDevelopers - Berlin - 2023  - Ron Veen.pdf
Modern Java - WeAreDevelopers - Berlin - 2023 - Ron Veen.pdf
 
The programming philosophy of jrql
The programming philosophy of jrqlThe programming philosophy of jrql
The programming philosophy of jrql
 
Corejava Training in Bangalore Tutorial
Corejava Training in Bangalore TutorialCorejava Training in Bangalore Tutorial
Corejava Training in Bangalore Tutorial
 
Lecture 5.pptx
Lecture 5.pptxLecture 5.pptx
Lecture 5.pptx
 
Java chapter 4
Java chapter 4Java chapter 4
Java chapter 4
 
Object-oriented Analysis, Design & Programming
Object-oriented Analysis, Design & ProgrammingObject-oriented Analysis, Design & Programming
Object-oriented Analysis, Design & Programming
 
Java cçccfftshrssfuutrfuuggiuffus201-java.ppt
Java cçccfftshrssfuutrfuuggiuffus201-java.pptJava cçccfftshrssfuutrfuuggiuffus201-java.ppt
Java cçccfftshrssfuutrfuuggiuffus201-java.ppt
 
Pi j2.2 classes
Pi j2.2 classesPi j2.2 classes
Pi j2.2 classes
 
Object oriented programming in java
Object oriented programming in javaObject oriented programming in java
Object oriented programming in java
 
static MEMBER IN OOPS PROGRAMING LANGUAGE.pptx
static MEMBER IN OOPS PROGRAMING LANGUAGE.pptxstatic MEMBER IN OOPS PROGRAMING LANGUAGE.pptx
static MEMBER IN OOPS PROGRAMING LANGUAGE.pptx
 
static members in object oriented program.pptx
static members in object oriented program.pptxstatic members in object oriented program.pptx
static members in object oriented program.pptx
 
Java
JavaJava
Java
 
Java
JavaJava
Java
 
Pi j2.3 objects
Pi j2.3 objectsPi j2.3 objects
Pi j2.3 objects
 
Python Programming - VI. Classes and Objects
Python Programming - VI. Classes and ObjectsPython Programming - VI. Classes and Objects
Python Programming - VI. Classes and Objects
 
class as the basis.pptx
class as the basis.pptxclass as the basis.pptx
class as the basis.pptx
 

Más de teknik komputer ui (20)

Modul 1
Modul 1Modul 1
Modul 1
 
Modul 5
Modul 5Modul 5
Modul 5
 
Modul 4
Modul 4Modul 4
Modul 4
 
Modul 3
Modul 3Modul 3
Modul 3
 
Modul 1
Modul 1Modul 1
Modul 1
 
Modul 2
Modul 2Modul 2
Modul 2
 
The cisco networking academy net riders indonesia 2010 competition
The cisco networking academy net riders indonesia 2010 competitionThe cisco networking academy net riders indonesia 2010 competition
The cisco networking academy net riders indonesia 2010 competition
 
Rencana Proyek Divisi Komputer.doc
Rencana Proyek Divisi Komputer.docRencana Proyek Divisi Komputer.doc
Rencana Proyek Divisi Komputer.doc
 
Salinan Research Paper
Salinan Research PaperSalinan Research Paper
Salinan Research Paper
 
Chapter_1_Case_Study
Chapter_1_Case_StudyChapter_1_Case_Study
Chapter_1_Case_Study
 
Iins practice questions
Iins practice questionsIins practice questions
Iins practice questions
 
S1 intr ftui
S1 intr ftuiS1 intr ftui
S1 intr ftui
 
Exploration network chapter7
Exploration network chapter7Exploration network chapter7
Exploration network chapter7
 
Exploration network chapter6
Exploration network chapter6Exploration network chapter6
Exploration network chapter6
 
Exploration network chapter5
Exploration network chapter5Exploration network chapter5
Exploration network chapter5
 
Exploration network chapter4
Exploration network chapter4Exploration network chapter4
Exploration network chapter4
 
Exploration network chapter3
Exploration network chapter3Exploration network chapter3
Exploration network chapter3
 
Exploration network chapter2
Exploration network chapter2Exploration network chapter2
Exploration network chapter2
 
Exploration network chapter1
Exploration network chapter1Exploration network chapter1
Exploration network chapter1
 
Exploration network chapter11
Exploration network chapter11Exploration network chapter11
Exploration network chapter11
 

Chapter3 bag2

  • 1. 3.1 Documentation & Java Language Elements
  • 2. 3.1.1 Purpose of documentation • Assist the programmer with developing the program • Assist other programers who wish to use or modify the program
  • 3. 3.1.2 Guidelines for documenting classes • Block comments – Start with /* and end with */. Can occupy multiple lines • Single line comments – The line starts with //
  • 4. 3.1.3 The javadoc parameters • The javadoc program can create HTML documents from the comments in the program’s source file • To create javadoc comments, use /** and */ • Special tags can be imbedded in the comments @author, @version, @param, @return, etc
  • 5. 3.1.4 Java API documentation
  • 6. 3.1.5 Generating API docs for classes using the javadoc tool
  • 7. 3.2.2 Keywords • Keywords form the Java vocabulary • The compiler is case-sensitive
  • 8. 3.2.3 Identifiers • Labels assigned to data or storage addresses • Rules for identifiers: – Any alphabetic character – First character must be a letter – Cannot contain space, % or # – Cannot be keywords
  • 9. 3.2.4 Use of braces, semicolons, commas, and white space • A block is a collection of statements bounded by braces { } • A statement consists of one or more lines of code, followed by a semicolon ; • Commas are used to delineate data • Whitespace is used to separate keywords and identifiers
  • 10. 3.3.1 Data storage introduction • Registers – Memory in the CPU • The Stack – Memory for methods and local variables • The Heap – Memory to store objects • Static – Stores data that will not change during the life of the program • Constant – Values that never change.
  • 11. 3.4.1 Java language types • Data type is the classification of forms of information • Data type is declared using keywords • Java is strongly typed
  • 12. 3.4.2 Java primitives • boolean – true or false • char – Stores a single UNICODE character • byte – Signed whole numbers from -127 to +128 • short – Signed whole numbers from -32,768 to +32,767 • int - Signed whole numbers from -231 to 231 -1 • long – Signed whole numbers from -9x1018 to 9x1018 -1 • float – Decimal values up to 6 – 7 decimal places • double – Decimal values up to 14 – 15 decimal places
  • 13. 3.4.3 Java references • Objects are created in heap memory • Programs use a variable that references the object • The program acts on the object by using the reference
  • 14. 3.4.4 Data • Object Data – Instance of a class, stored on the heap • Static Class Data – Available before the object is created • Local Data – Exists in methods, stored on the stack • Constants – Data that will not change • Variables – Holds a primitive or a reference to an object
  • 15. 3.4.4 Data (example) public class Student { private final String studentName; public static final int courseNumber = 12345; public String grade; public Student(String name, String grd) { studentName = name; grade = grd; } public void changeGrade(String grd) { grade = grd; } Try to Identify!!!!! public String getName() { 1. Object Data/Variable return studentName; 2. Static Data/Variable } } 3. Local Data/Variable 4. Constants
  • 16. 3.5.2 Elements • Class – Template or blueprint for object creation • Method – A block of statements that control an object’s behavior • Constructor – A special method that is called when the object is created • Modifiers – private, public, protected, default, static, final
  • 17. 3.5.2 Elements public class Student { private final String studentName; public static final int courseNumber = 12345; public String grade; public Student(String name, String grd) { studentName = name; constructor grade = grd; class } public void changeGrade(String grd) { grade = grd; method } public String getName() { return studentName; } }
  • 18. 3.6.1 Five steps of object creation • Declaration of a reference variable • Default initialization • Explicit initialization • Execution of the constructor • Assignment of object’s address to reference variable
  • 19. 3.6.3 Mutability, Garbage Collection & Finalizers • Most data is mutable, and can be changed. To make it immutable, use the final keyword • Garbage collection frees up memory occupied by unused objects. This process cannot be controlled • Every object inherits a finalizer method, that will be executed when the object is released
  • 20. Individual activity & Lab Work • Possible Lab Schedule every: – Monday, 15.00-16.50 or – Friday, 14.30 - 15.20 (PUSKOM-FTUI) • TODO LIST (finished before next session): – Read through the online curriculum – Take the module exam 1 – 3 (Start: Thursday) – Do LABs: • 3.1.6.1 Insert Documentation for Classes in the JBANK Application • 3.1.6.2 Generate API Docs for JBANK Classes with the javadoc Tool • 3.5.1 Define Variables • 3.5.9 Apply Access Modifiers • 3.6.1 Use of Constructors • 3.8.1 Create the Classes for Phase I of the JBANK Application Note: Red bold color is obligatory to be submitted to ECourse System!