5-supplemental

.pdf

School

University Of Georgia *

*We aren’t endorsed by this school

Course

1301

Subject

Computer Science

Date

Oct 30, 2023

Type

pdf

Pages

52

Uploaded by PresidentSummer1250

Report
Java Object-Oriented Programming Java is an object-oriented programming language. A program can be viewed as a collection of interacting objects. Some objects might represent physical entities (automobiles); others might have no counterpart in the real world (Scanner). Each object has a set of characteristics ( attributes/data ). An object representing a student might have: first name, last name, 810-number, email-address, course-load . The attribute values define the object’s state . Each object has a set of actions it can perform (its behaviors ). Examples: add a course, drop a course.
Classes and objects 2 Picture from https://chortle.ccsu.edu/java5/index.html#25
Classes An object in OOP is defined by a class . Variables are used to define attributes. Methods in the class define the objects behaviors. A class is the blueprint/template for creating objects. Every object belongs to a class. Once the class is defined, multiple objects ( instances of the class) can be created from it. Essentially, we are creating our own data types!
Simplified UML diagram of class String 4
Classes To date, we haven’t used many of the object-oriented features in Java. We have instantiated (created) objects from pre-defined classes String , Scanner . We have created “instances” of these classes. But we haven’t defined our own classes yet.
Classes in Java Java is an object oriented programming language. A Java class definition might look something like this: public class Student { public String firstName; public String lastName; public String email; public void addCourse(Course aCourse){ { // (This is a comment); // More code should go here. } public void printSchedule(){ { // Again More code should go here. } // Etc. More code could go here. } Variables defining attributes of the class (instance variables) Methods defining behaviors of the class. The first method takes an argument, which it uses to do its stuff. Class name Class body
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help

Browse Popular Homework Q&A

Q: Explain how object-oriented and procedural programming languages vary from one another in terms of…
Q: In science it is often useful to estimate if a measurement is "in the right ballpark" by comparing…
Q: What biases toward people with disabilities exist today? How might these be eliminated?
Q: What is the iOS Xcode syntax/command to create text boxes?
Q: Exercise 2. Present an O(n) algorithm that sorts n positive integer numbers a1, A2,..., an which are…
Q: (*28 *0] °SPRIPE = J do not Catalunioo pucalend Spie :(ks 0.] Lovrsini ant 6 Prove, stating…
Q: Find the equivalent inductance looking into the terminals of the circuit. Take L = 8 H. 10 H m 9H m…
Q: Find the equation of the regression line for the given points. Round any final values to the nearest…
Q: What methods do workers use to guarantee that the information they have learned stays inside the…
Q: Given the truth function implementation (circuit diagram), identify the maxterms in the function's…
Q: How many 1H NMR signals does each dimethylcyclopropane show?
Q: 1.  Explain the Yerkes-Dodson Law. 2. Walk me through an example in your life where the…
Q: The specific heat of mercury is 0.140 J/g°C. Calculate the heat necessary to raise the temperature…
Q: Discuss medications typically given to burn patients.  Medication  Rationale Analgesics/Sedatives…
Q: Consider a particle moving along the x-axis, where x(t) is the position of the particle at time t,…
Q: The specific heat of water is 4.18 J/g-K. AHsolution When a 9.15-g sample of gaseous hydrogen…
Q: K Graph the equation by plotting points. y=-3x+9 Complete the ordered pairs in the table below. X -2…
Q: 4. Show that each of these conditional statements is a tautology (true compound propositions) by…
Q: Calculate AS° values for the following reactions by using tabulated sº values from Appendix
Q: 5. pg 124 Metabolic rate Metabolic rate, the rate at which the body consumes energy, is important in…
Q: A bacteriophage strain carrying a point mutation is crossed with a bacteriophage strain carrying a…
Q: How do you create buttons in Xcode?