Preview

Java

Satisfactory Essays
Open Document
Open Document
473 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Java
OOP2: Object Oriented Programming 2 (Java)

Jocel L. Garrido,CCNA

Object Oriented Programming 2 (Java) Instructor: Jocel L. Garrido Classes 3 Parts: -Class Name -Attributes -Functions or methods

class Reading_Material public class Reading_Material {

public class Reading_Material { private String Title, Publisher; private int date_published, current_page; public int get_page() { return current_page; }

-Title -Publisher -date_published -current_page

private String Title, Publisher; private int date_published, current_page; public int get_page() { }

return current_page;

+get_page +turn_page_forward +turn_page_backward +get_Publisher +get_date_published +get_Title

Syntax: class { [] [] [] }

Example: public class Person { //attribute declarations private String name; private int age; private Date birthday; // class constructor public Person() { name = "secret"; age = 0; birthday = new Date(7,7); }

//accessor methods - setters public void setName(String X){ name= X; } }

OOP2: Object Oriented Programming 2 (Java)

Jocel L. Garrido,CCNA

• • • •

What is a Method? A method refers to a piece of code referring to behaviors associated either with an object or its class A code found in a class for responding to a message The executable code that implements the logic of a particular message for a class An operation or function that is associated with an object and is allowed to manipulate the object's data A method call is thus considered to be a request to an object to perform some task.

Creating a Method
Steps in declaring a method 1. Set the return type 2. Provide method name 3. Declare formal parameters method signature • consists of the method name and its parameters • must be unique for each method in a class A method with empty parameters

class Number { int multiply(int i, int j) { return i*j; } int divide(int i, int j) { return i/j; } double getPi() { return 3.14159265358979; }

return statement • allows the method

You May Also Find These Documents Helpful

  • Satisfactory Essays

    Attribute-Based Programming: Attributes assist you to add declarative information in your programs. This information can then be queried at runtime using reflection.…

    • 485 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    Mat 540 Week 4 Paper

    • 1775 Words
    • 8 Pages

    Although the details can be quite complex, these details are the basic principles of object-oriented programming.…

    • 1775 Words
    • 8 Pages
    Powerful Essays
  • Satisfactory Essays

    The first step in the scientific method is to observe. When you are observing you are discovering what is going on around you. The second step in the scientific method is question. To question one must make an attempt to explain the observation that was made. The next step in the scientific method is making a hypothesis. A hypothesis is made to predict a solution and an outcome. The fourth step in the scientific method is making a prediction. When making a prediction you are indicating the outcome. Next is the conclusion. The conclusion details the findings of the testing. This then leads to the final step which is the results. The results are whether your findings based on the hypothesis…

    • 313 Words
    • 2 Pages
    Satisfactory Essays
  • Better Essays

    Biology 108 Worksheet

    • 1048 Words
    • 5 Pages

    5. List and give a brief explanation of the steps of the scientific method. The steps of a scientific method make up an orderly way of gaining information. The first step is observation where the scientist recognizes that something has happened and gathers the data to research. Then formulate a hypothesis trying to come up with a solution, after more observation of the hypothesis & then finally draws a conclusion.…

    • 1048 Words
    • 5 Pages
    Better Essays
  • Satisfactory Essays

    Homework 1

    • 733 Words
    • 3 Pages

    Scientific method utilizes a series of facts, hypotheses, laws, and the theories to explain observations in the natural world. It involves observing, coming up with a hypothesis and make predictions, test those predictions and repeat to find the similar results.…

    • 733 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    concepts of classes, objects, constructors, methods, access control, this keyword, overloading methods and constructors, parameter…

    • 414 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    2301 Final Psy

    • 373 Words
    • 2 Pages

    The scientific method is a self-correcting process for asking questions and observing natures answers; relies on collecting data, generating a…

    • 373 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    Programming

    • 3038 Words
    • 13 Pages

    2. Each of the flowchart segments in Figure 3-35 is unstructured. Redraw each flowchart segment so that it does the same thing but is structured.…

    • 3038 Words
    • 13 Pages
    Good Essays
  • Good Essays

    References: • Nirosh. (2010). Introduction to Object Oriented Programming Concepts (OOP) and More. The Code Project. Retrieved from: http://www.codeproject.com/KB/architecture/OOP_Concepts_and_manymore.aspx.…

    • 817 Words
    • 4 Pages
    Good Essays
  • Good Essays

    Object Oriented Processes

    • 400 Words
    • 2 Pages

    Identify how you can encapsulate the data and processes you identified into an object-oriented design.…

    • 400 Words
    • 2 Pages
    Good Essays
  • Satisfactory Essays

    On the order hand, Object oriented programming (OOP) have taken the best ideas of structured programming and combined them with several powerful new concept that encourage you to approach the task of programming in a new way. Object-oriented programming is a programming methodology that associates data structures with a set of operators that act upon it. In OOP’s terminology an instance of such an entity is known as an object, it gives importance to relationships between objects rather than implementation details. Object-Oriented Programming is centered on new concepts such as classes, polymorphism, inheritance, etc.…

    • 641 Words
    • 3 Pages
    Satisfactory Essays
  • Good Essays

    Copro 2 Reviewer 2014

    • 557 Words
    • 3 Pages

    Classes is a term that describes a group or collection of objects with common properties.…

    • 557 Words
    • 3 Pages
    Good Essays
  • Better Essays

    Relational Database Model

    • 964 Words
    • 4 Pages

    When designing a Relational Database, you must create a table for each entity type, choose or invent a primary key for each table; add foreign keys to represent one-to-many relationships; create new tables to represent many-to-many relationships; define referential integrity constraints; evaluate schema quality and make necessary improvements; and choose appropriate data types and value restrictions for each field (if necessary).…

    • 964 Words
    • 4 Pages
    Better Essays
  • Satisfactory Essays

    Java Programming

    • 461 Words
    • 2 Pages

    Tipping has become just a normal expense already calculated into ones dining experience. It is understood that most services that provide us consumers a way to measure how satisfied we are with the experience of vending with a particular merchant; is done so through tipping.…

    • 461 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Identify how you can encapsulate the data and processes you identified into an object-oriented design.…

    • 506 Words
    • 2 Pages
    Satisfactory Essays

Related Topics