Introduction to Computer Science I
|
|
- Justina Clara Jacobs
- 5 years ago
- Views:
Transcription
1 Introduction to Computer Science I Classes Janyl Jumadinova 5-7 March, 2018
2 Classes Most of our previous programs all just had a main() method in one file. 2/13
3 Classes Most of our previous programs all just had a main() method in one file. Most programs are composed of the main() method for the primary class and one or more additional, supporting classes. 2/13
4 Classes Most of our previous programs all just had a main() method in one file. Most programs are composed of the main() method for the primary class and one or more additional, supporting classes. These additional classes do not have main() methods, but have other methods to implement behaviors. 2/13
5 Classes Most of our previous programs all just had a main() method in one file. Most programs are composed of the main() method for the primary class and one or more additional, supporting classes. These additional classes do not have main() methods, but have other methods to implement behaviors. Remember: Classes are templates for objects Objects are composed of data members (attributes) and member methods (behaviors) Objects respond to messages 2/13
6 Defining a Method Think about creating methods in terms of three things: 1. Parameters - Parameters/arguments/values to send to a method? - What does the method need so that it can do its job? 3/13
7 Defining a Method Think about creating methods in terms of three things: 1. Parameters - Parameters/arguments/values to send to a method? - What does the method need so that it can do its job? 2. Task - What does the method do? 3/13
8 Defining a Method Think about creating methods in terms of three things: 1. Parameters - Parameters/arguments/values to send to a method? - What does the method need so that it can do its job? 2. Task - What does the method do? 3. Return/Results - What does the method produce as a result? - What is it s final answer? - Does it even need to return anything? 3/13
9 4/13
10 Gradebook class // Define class GradeBook with a method displaymessage public class GradeBook { // method to display a welcome message // to the GradeBook user public void displaymessage () { System.out.println("Welcome to the Grade Book!"); } } 5/13
11 Gradebook class This class by itself is not useful in that you can compile it to a.class file, but you cannot execute it with the JVM since there is no main() method. We will need to create a separate class that will use or instantiate an object of this class. 6/13
12 GradebookMain class // Now we have a.java file that uses the GradeBook class, // like creating an int variable. This creates or // instantiates a new variable or object // called mygradebook of the GradeBook class. public class GradeBookMain { public static void main ( String args[] ) { GradeBook mygradebook = new GradeBook (); mygradebook.displaymessage(); } } 7/13
13 GradeBook class UML Diagram Top compartment: - Name of class, Bolded, Centered 8/13
14 GradeBook class UML Diagram Top compartment: - Name of class, Bolded, Centered Middle compartment: - Attributes (data members) 8/13
15 GradeBook class UML Diagram Top compartment: - Name of class, Bolded, Centered Middle compartment: - Attributes (data members) Bottom compartment: - Behaviors (member methods), method name, followed by parentheses - Plus (+) sign indicates public member method 8/13
16 GradeBook class with argument Bottom compartment: - Behaviors (member methods) - method name, followed by parentheses - Plus (+) sign indicates public member method - Parameters are listed in the parentheses, name first followed by a colon and the data type - Data type is language-independent since the UML is used by multiple languages 9/13
17 GradeBook class with instance variables Middle Compartment: - Attributes (data members) - Minus (-) sign indicates private member method - Data member name followed by colon and data type 10/13
18 GradeBook class with instance variables Middle Compartment: - Attributes (data members) - Minus (-) sign indicates private member method - Data member name followed by colon and data type Bottom compartment: - Parentheses followed by colon and return data type 10/13
19 Constructor A special method that is used to initialize a newly created object. All Java objects have a constructor, even if you don t specifically code it. 11/13
20 Constructor A special method that is used to initialize a newly created object. All Java objects have a constructor, even if you don t specifically code it. Default constructor created by the compiler: public Dog () { } Constructor is called just after the memory is allocated for the object. Constructors may contain code that is run when the object is created (initializes the object. A constructor must have the same name as the class its in. 11/13
21 GradeBook class with a constructor Indicate a constructor using constructor before name Constructor usually listed first 12/13
22 Reference Data Types Reference data types, also known as non-primitive types, are user-defined classes such as Dog or GradeBook. 13/13
23 Reference Data Types Reference data types, also known as non-primitive types, are user-defined classes such as Dog or GradeBook. Reference variables contain a reference to an object of the specified class. 13/13
24 Reference Data Types Reference data types, also known as non-primitive types, are user-defined classes such as Dog or GradeBook. Reference variables contain a reference to an object of the specified class. Reference variables allow you send messages to objects, such as mygradebook.displaymessage(). 13/13
25 Reference Data Types Reference data types, also known as non-primitive types, are user-defined classes such as Dog or GradeBook. Reference variables contain a reference to an object of the specified class. Reference variables allow you send messages to objects, such as mygradebook.displaymessage(). Primitive-type variables are not objects, so cannot receive messages. 13/13
Lecture 7: Classes and Objects CS2301
Lecture 7: Classes and Objects NADA ALZAHRANI CS2301 1 What is OOP? Object-oriented programming (OOP) involves programming using objects. An object represents an entity in the real world that can be distinctly
More informationHow to engineer a class to separate its interface from its implementation and encourage reuse.
1 3 Introduction to Classes and Objects 2 OBJECTIVES In this chapter you ll learn: What classes, objects, member functions and data members are. How to define a class and use it to create an object. How
More informationA A B U n i v e r s i t y
A A B U n i v e r s i t y Faculty of Computer Sciences O b j e c t O r i e n t e d P r o g r a m m i n g Week 4: Introduction to Classes and Objects Asst. Prof. Dr. M entor Hamiti mentor.hamiti@universitetiaab.com
More informationIntroduction to Classes and Objects Pearson Education, Inc. All rights reserved.
1 3 Introduction to Classes and Objects 2 You will see something new. Two things. And I call them Thing One and Thing Two. Dr. Theodor Seuss Geisel Nothing can have value without being an object of utility.
More informationby Pearson Education, Inc. All Rights Reserved. 2
Suppose you want to drive a car and make it go faster by pressing down on its accelerator pedal. Before you can drive a car, someone has to design it and build it. A car typically begins as engineering
More informationIntroduction to Classes and Objects Pearson Education, Inc. All rights reserved.
1 3 Introduction to Classes and Objects 2 You will see something new. Two things. And I call them Thing One and Thing Two. Dr. Theodor Seuss Geisel Nothing can have value without being an object of utility.
More informationWelcome1.java // Fig. 2.1: Welcome1.java // Text-printing program.
1 Welcome1.java // Fig. 2.1: Welcome1.java // Text-printing program. public class Welcome1 // main method begins execution of Java application System.out.println( "Welcome to Java Programming!" ); } //
More informationIntroduction to Classes and Objects
1 2 Introduction to Classes and Objects You will see something new. Two things. And I call them Thing One and Thing Two. Dr. Theodor Seuss Geisel Nothing can have value without being an object of utility.
More informationFundamentals of Programming Session 25
Fundamentals of Programming Session 25 Instructor: Reza Entezari-Maleki Email: entezari@ce.sharif.edu 1 Fall 2014 These slides have been created using Deitel s slides Sharif University of Technology Outlines
More informationJava How to Program, 10/e. Copyright by Pearson Education, Inc. All Rights Reserved.
Java How to Program, 10/e Education, Inc. All Rights Reserved. Each class you create becomes a new type that can be used to declare variables and create objects. You can declare new classes as needed;
More informationCSE 142 Su 04 Computer Programming 1 - Java. Objects
Objects Objects have state and behavior. State is maintained in instance variables which live as long as the object does. Behavior is implemented in methods, which can be called by other objects to request
More informationAL GHURAIR UNIVERSITY College of Computing. Objectives: Examples: if Single-Selection Statement CSC 209 JAVA I. week 3- Control Statements: Part I
AL GHURAIR UNIVERSITY College of Computing CSC 209 JAVA I week 3- Control Statements: Part I Objectives: To use the if and if...else selection statements to choose among alternative actions. To use the
More information12/22/11. Java How to Program, 9/e. public must be stored in a file that has the same name as the class and ends with the.java file-name extension.
Java How to Program, 9/e Education, Inc. All Rights Reserved. } Covered in this chapter Classes Objects Methods Parameters double primitive type } Create a new class (GradeBook) } Use it to create an object.
More informationObject Oriented Programming. Java-Lecture 1
Object Oriented Programming Java-Lecture 1 Standard output System.out is known as the standard output object Methods to display text onto the standard output System.out.print prints text onto the screen
More informationFundamentals of Programming Session 23
Fundamentals of Programming Session 23 Instructor: Reza Entezari-Maleki Email: entezari@ce.sharif.edu 1 Fall 2013 These slides have been created using Deitel s slides Sharif University of Technology Outlines
More informationComputer Programming C++ Classes and Objects 6 th Lecture
Computer Programming C++ Classes and Objects 6 th Lecture 엄현상 (Eom, Hyeonsang) School of Computer Science and Engineering Seoul National University Copyrights 2015 Eom, Hyeonsang All Rights Reserved Outline
More informationUniversità degli Studi di Bologna Facoltà di Ingegneria. Principles, Models, and Applications for Distributed Systems M
Università degli Studi di Bologna Facoltà di Ingegneria Principles, Models, and Applications for Distributed Systems M Control Structures Intro. Sequential execution Statements are normally executed one
More informationComputational Expression
Computational Expression, Math Class, Wrapper Classes Janyl Jumadinova 18 February, 2019 Janyl Jumadinova Computational Expression 18 February, 2019 1 / 8 The Random class is part of the java.util package
More information1.00 Lecture 8. Using An Existing Class, cont.
.00 Lecture 8 Classes, continued Reading for next time: Big Java: sections 7.9 Using An Existing Class, cont. From last time: is a Java class used by the BusTransfer class BusTransfer uses objects: First
More informationClasses and Objects 3/28/2017. How can multiple methods within a Java class read and write the same variable?
Peer Instruction 8 Classes and Objects How can multiple methods within a Java class read and write the same variable? A. Allow one method to reference a local variable of the other B. Declare a variable
More informationObject Oriented Design
Object Oriented Design Lecture 3: Introduction to C++ (Continue) Examples using declarations that eliminate the need to repeat the std:: prefix 1 Examples using namespace std; enables a program to use
More informationComputational Expression
Computational Expression Variables, Primitive Data Types, Expressions Janyl Jumadinova 28-30 January, 2019 Janyl Jumadinova Computational Expression 28-30 January, 2019 1 / 17 Variables Variable is a name
More informationBasic Problem solving Techniques Top Down stepwise refinement If & if else.. While.. Counter controlled and sentinel controlled repetition Usage of
Basic Problem solving Techniques Top Down stepwise refinement If & if.. While.. Counter controlled and sentinel controlled repetition Usage of Assignment increment & decrement operators 1 ECE 161 WEEK
More informationCpt S 122 Data Structures. Introduction to C++ Part II
Cpt S 122 Data Structures Introduction to C++ Part II Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Topics Objectives Defining class with a member function
More informationComputational Expression
Computational Expression Do While Loop, For Loop, Arrays Janyl Jumadinova 26 November, 2018 Janyl Jumadinova Computational Expression 26 November, 2018 1 / 18 Review: Repetition structures while() loop
More informationChapter 6 Introduction to Defining Classes
Introduction to Defining Classes Fundamentals of Java: AP Computer Science Essentials, 4th Edition 1 Objectives Design and implement a simple class from user requirements. Organize a program in terms of
More informationJava: Classes. An instance of a class is an object based on the class. Creation of an instance from a class is called instantiation.
Java: Classes Introduction A class defines the abstract characteristics of a thing (object), including its attributes and what it can do. Every Java program is composed of at least one class. From a programming
More informationAssoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved.
Assoc. Prof. Dr. Marenglen Biba Laboratory Session: Exercises on classes Analogy to help you understand classes and their contents. Suppose you want to drive a car and make it go faster by pressing down
More informationProgramming Language Concepts Scoping. Janyl Jumadinova January 31, 2017
Programming Language Concepts Scoping Janyl Jumadinova January 31, 2017 Scope Rules A scope is a program section of maximal size in which no bindings change, or at least in which no re-declarations are
More informationSoftware Design and Analysis for Engineers
Software Design and Analysis for Engineers by Dr. Lesley Shannon Email: lshannon@ensc.sfu.ca Course Website: http://www.ensc.sfu.ca/~lshannon/courses/ensc251 Simon Fraser University Slide Set: 2 Date:
More informationComputational Expression
Computational Expression Conditionals Janyl Jumadinova 10 October, 2018 Janyl Jumadinova Computational Expression 10 October, 2018 1 / 16 Computational Thinking: a problem solving process Decomposition
More informationThis exam is open book. Each question is worth 3 points.
This exam is open book. Each question is worth 3 points. Page 1 / 15 Page 2 / 15 Page 3 / 12 Page 4 / 18 Page 5 / 15 Page 6 / 9 Page 7 / 12 Page 8 / 6 Total / 100 (maximum is 102) 1. Are you in CS101 or
More informationCS111: PROGRAMMING LANGUAGE II. Lecture 1: Introduction to classes
CS111: PROGRAMMING LANGUAGE II Lecture 1: Introduction to classes Lecture Contents 2 What is a class? Encapsulation Class basics: Data Methods Objects Defining and using a class In Java 3 Java is an object-oriented
More information3.1 Class Declaration
Chapter 3 Classes and Objects OBJECTIVES To be able to declare classes To understand object references To understand the mechanism of parameter passing To be able to use static member and instance member
More informationMethods. Contents Anatomy of a Method How to design a Method Static methods Additional Reading. Anatomy of a Method
Methods Objectives: 1. create a method with arguments 2. create a method with return value 3. use method arguments 4. use the return keyword 5. use the static keyword 6. write and invoke static methods
More informationSubclass Gist Example: Chess Super Keyword Shadowing Overriding Why? L10 - Polymorphism and Abstract Classes The Four Principles of Object Oriented
Table of Contents L01 - Introduction L02 - Strings Some Examples Reserved Characters Operations Immutability Equality Wrappers and Primitives Boxing/Unboxing Boxing Unboxing Formatting L03 - Input and
More informationZhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson
Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson Introduction History, Characteristics of Java language Java Language Basics Data types, Variables, Operators and Expressions Anatomy of a Java Program
More informationAgenda CS121/IS223. Reminder. Object Declaration, Creation, Assignment. What is Going On? Variables in Java
CS121/IS223 Object Reference Variables Dr Olly Gotel ogotel@pace.edu http://csis.pace.edu/~ogotel Having problems? -- Come see me or call me in my office hours -- Use the CSIS programming tutors Agenda
More informationTwo Types of Types. Primitive Types in Java. Using Primitive Variables. Class #07: Java Primitives. Integer types.
Class #07: Java Primitives Software Design I (CS 120): M. Allen, 13 Sep. 2018 Two Types of Types So far, we have mainly been dealing with objects, like DrawingGizmo, Window, Triangle, that are: 1. Specified
More informationJava Primer 1: Types, Classes and Operators
Java Primer 1 3/18/14 Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia, and M. H. Goldwasser, Wiley, 2014 Java Primer 1: Types,
More informationCS 231 Data Structures and Algorithms, Fall 2016
CS 231 Data Structures and Algorithms, Fall 2016 Dr. Bruce A. Maxwell Department of Computer Science Colby College Course Description Focuses on the common structures used to store data and the standard
More informationCHAPTER 7 OBJECTS AND CLASSES
CHAPTER 7 OBJECTS AND CLASSES OBJECTIVES After completing Objects and Classes, you will be able to: Explain the use of classes in Java for representing structured data. Distinguish between objects and
More informationFunctions and an Introduction to Recursion Pearson Education, Inc. All rights reserved.
1 6 Functions and an Introduction to Recursion 2 Form ever follows function. Louis Henri Sullivan E pluribus unum. (One composed of many.) Virgil O! call back yesterday, bid time return. William Shakespeare
More informationCOP 3330 Final Exam Review
COP 3330 Final Exam Review I. The Basics (Chapters 2, 5, 6) a. comments b. identifiers, reserved words c. white space d. compilers vs. interpreters e. syntax, semantics f. errors i. syntax ii. run-time
More informationCS121/IS223. Object Reference Variables. Dr Olly Gotel
CS121/IS223 Object Reference Variables Dr Olly Gotel ogotel@pace.edu http://csis.pace.edu/~ogotel Having problems? -- Come see me or call me in my office hours -- Use the CSIS programming tutors CS121/IS223
More informationImplementing an ADT with a Class
Implementing an ADT with a Class the header file contains the class definition the source code file normally contains the class s method definitions when using Visual C++ 2012, the source code and the
More informationUpdates. Office B116E Office Hours : Friday 1 p.m. 2 p.m. Also by appointment Office Hours Purpose:
CS 180 Amit Gupta Updates Office B116E Office Hours : Friday 1 p.m. 2 p.m. Also by appointment gupta75@purdue.edu Office Hours Purpose: Course Material and Recitation No project questions Quizzes I will
More informationLecture 02, Fall 2018 Friday September 7
Anatomy of a class Oliver W. Layton CS231: Data Structures and Algorithms Lecture 02, Fall 2018 Friday September 7 Follow-up Python is also cross-platform. What s the advantage of Java? It s true: Python
More informationCOMP 250 Winter 2011 Reading: Java background January 5, 2011
Almost all of you have taken COMP 202 or equivalent, so I am assuming that you are familiar with the basic techniques and definitions of Java covered in that course. Those of you who have not taken a COMP
More informationProject 1. Java Control Structures 1/17/2014. Project 1 and Java Intro. Project 1 (2) To familiarize with
Project 1 and Java Intro Sharma Chakravarthy Information Technology Laboratory (IT Lab) Computer Science and Engineering Department The University of Texas at Arlington, Arlington, TX 76019 Email: sharma@cse.uta.edu
More informationProgramming overview
Programming overview Basic Java A Java program consists of: One or more classes A class contains one or more methods A method contains program statements Each class in a separate file MyClass defined in
More informationComputational Expression
Computational Expression String Class Janyl Jumadinova 24 September, 2018 Janyl Jumadinova Computational Expression 24 September, 2018 1 / 16 Data Types: Review Java has two categories of data: - primitive
More informationChapter 6 Lab Classes and Objects
Gaddis_516907_Java 4/10/07 2:10 PM Page 51 Chapter 6 Lab Classes and Objects Objectives Be able to declare a new class Be able to write a constructor Be able to write instance methods that return a value
More informationC++ Important Questions with Answers
1. Name the operators that cannot be overloaded. sizeof,.,.*,.->, ::,? 2. What is inheritance? Inheritance is property such that a parent (or super) class passes the characteristics of itself to children
More informationComputational Expression
Computational Expression Scanner, Increment/Decrement, Conversion Janyl Jumadinova 17 September, 2018 Janyl Jumadinova Computational Expression 17 September, 2018 1 / 11 Review: Scanner The Scanner class
More informationComputer Science II. OO Programming Classes Scott C Johnson Rochester Institute of Technology
Computer Science II OO Programming Classes Scott C Johnson Rochester Institute of Technology Outline Object-Oriented (OO) Programming Review Initial Implementation Constructors Other Standard Behaviors
More informationAP Computer Science Chapter 10 Implementing and Using Classes Study Guide
AP Computer Science Chapter 10 Implementing and Using Classes Study Guide 1. A class that uses a given class X is called a client of X. 2. Private features of a class can be directly accessed only within
More informationJavadocing in Netbeans (rev )
Javadocing in Netbeans (rev. 2011-05-20) This note describes how to embed HTML-style graphics within your Javadocs, if you are using Netbeans. Additionally, I provide a few hints for package level and
More informationLesson 12: OOP #2, Accessor Methods (W03D4)
Lesson 12: OOP #2, Accessor Methods (W03D4) Balboa High School Michael Ferraro September 3, 2015 1 / 29 Do Now In your driver class from last class, create another new Person object with these characteristics:
More informationChapter 4 Java Language Fundamentals
Chapter 4 Java Language Fundamentals Develop code that declares classes, interfaces, and enums, and includes the appropriate use of package and import statements Explain the effect of modifiers Given an
More information1.00 Introduction to Computers and Engineering Problem Solving Quiz 1 March 4, 2005
1.00 Introduction to Computers and Engineering Problem Solving Quiz 1 March 4, 2005 Name: E-mail Address: TA: Section: You have 80 minutes to complete this exam. For coding questions, you do not need to
More informationUML IB Computer Science. Content developed by Dartford Grammar School Computer Science Department
UML IB Computer Science Content developed by Dartford Grammar School Computer Science Department HL Topics 1-7, D1-4 1: System design 2: Computer Organisation 3: Networks 4: Computational thinking 5: Abstract
More informationJAVA- PROGRAMMING CH2-EX1
http://www.tutorialspoint.com/java/java_overriding.htm package javaapplication1; public class ch1_ex1 JAVA- PROGRAMMING CH2-EX1 //main method public static void main(string[] args) System.out.print("hello
More informationAPCS Semester #1 Final Exam Practice Problems
Name: Date: Per: AP Computer Science, Mr. Ferraro APCS Semester #1 Final Exam Practice Problems The problems here are to get you thinking about topics we ve visited thus far in preparation for the semester
More information1.00 Introduction to Computers and Engineering Problem Solving. Quiz 1 March 7, 2003
1.00 Introduction to Computers and Engineering Problem Solving Quiz 1 March 7, 2003 Name: Email Address: TA: Section: You have 90 minutes to complete this exam. For coding questions, you do not need to
More informationNon-instantiable Classes
Instantiable Classes It is not acceptable to write a program using just the main method. Why? Programs become too large and unmanageable It is not acceptable to write programs using just predefined classes.
More informationEmbedding Graphics in JavaDocs (netbeans IDE)
Embedding Graphics in JavaDocs (netbeans IDE) This note describes how to embed HTML-style graphics within your JavaDocs, if you are using Netbeans. Additionally, I provide a few hints for package level
More informationQUIZ on Ch.5. Why is it sometimes not a good idea to place the private part of the interface in a header file?
QUIZ on Ch.5 Why is it sometimes not a good idea to place the private part of the interface in a header file? Example projects where we don t want the implementation visible to the client programmer: The
More informationJava Foundations Certified Junior Associate
Java Foundations Certified Junior Associate 习题 1. When the program runs normally (when not in debug mode), which statement is true about breakpoints? Breakpoints will stop program execution at the last
More informationFunctions and Recursion
Functions and Recursion 1 Outline Introduction Program Components in C++ Math Library Functions Functions Function Definitions Function Prototypes Header Files Random Number Generation Example: A Game
More informationBinghamton University. CS-140 Fall Problem Solving. Creating a class from scratch
Problem Solving Creating a class from scratch 1 Recipe for Writing a Class 1. Write the class boilerplate stuff 2. Declare Fields 3. Write Creator(s) 4. Write accessor methods 5. Write mutator methods
More informationProgramming with Objects
Programming with Objects Writing your own Classes As this topic is covered in great detail in Chapter 4 of the book, I will just review the main concepts here. We have already briefly encountered a user-defined
More informationCOMSC-051 Java Programming Part 1. Part-Time Instructor: Joenil Mistal
COMSC-051 Java Programming Part 1 Part-Time Instructor: Joenil Mistal Chapter 4 4 Moving Toward Object- Oriented Programming This chapter provides a provides an overview of basic concepts of the object-oriented
More informationUnit 4 - Inheritance, Packages & Interfaces
Inheritance Inheritance is the process, by which class can acquire the properties and methods of its parent class. The mechanism of deriving a new child class from an old parent class is called inheritance.
More informationCHAPTER 7 OBJECTS AND CLASSES
CHAPTER 7 OBJECTS AND CLASSES OBJECTIVES After completing Objects and Classes, you will be able to: Explain the use of classes in Java for representing structured data. Distinguish between objects and
More informationCSE 113 A. Announcements - Lab
CSE 113 A February 21-25, 2011 Announcements - Lab Lab 1, 2, 3, 4; Practice Assignment 1, 2, 3, 4 grades are available in Web-CAT look under Results -> Past Results and if looking for Lab 1, make sure
More informationChapter 7 Classes & Objects, Part B
Chapter 7 Classes & Objects, Part B These note present Dog simulation example that shows how we go about OO modeling. A number of new things are introduced. They also present the Person > BirthDate example.
More informationChapter 1 Introduction to Computers, Programs, and Java
Chapter 1 Introduction to Computers, Programs, and Java 1 Programs Computer programs, known as software, are instructions to the computer. You tell a computer what to do through programs. Without programs,
More informationAssoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved.
Assoc. Prof. Dr. Marenglen Biba (C) 2010 Pearson Education, Inc. All rights reserved. Java application A computer program that executes when you use the java command to launch the Java Virtual Machine
More informationChapter 15: Object Oriented Programming
Chapter 15: Object Oriented Programming Think Java: How to Think Like a Computer Scientist 5.1.2 by Allen B. Downey How do Software Developers use OOP? Defining classes to create objects UML diagrams to
More informationCS 101 Spring 2006 Final Exam Name: ID:
This exam is open text book but closed-notes, closed-calculator, closed-neighbor, etc. Unlike the midterm exams, you have a full 3 hours to work on this exam. Please sign the honor pledge here: Page 1
More informationCS 251 Intermediate Programming Methods and Classes
CS 251 Intermediate Programming Methods and Classes Brooke Chenoweth University of New Mexico Fall 2018 Methods An operation that can be performed on an object Has return type and parameters Method with
More informationCS 251 Intermediate Programming Methods and More
CS 251 Intermediate Programming Methods and More Brooke Chenoweth University of New Mexico Spring 2018 Methods An operation that can be performed on an object Has return type and parameters Method with
More informationSoftware and Programming 1
Software and Programming 1 Lab 8: Use of classes, static class variables and methods 1st March 2018 SP1-Lab8-2018.pdf Tobi Brodie (Tobi@dcs.bbk.ac.uk) 1 Lab 8 Objectives Understanding the encapsulation
More informationIntroduction to Programming Using Java (98-388)
Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;
More informationCreating Classes and Objects
Creating Classes and Objects 7-2 /* For several lines */ Scope Starting point Every Java program consists of at least one class that you define. Java is case sensitive uppercase. javac Welcome1.java javadoc
More informationChapter 4 Defining Classes I
Chapter 4 Defining Classes I This chapter introduces the idea that students can create their own classes and therefore their own objects. Introduced is the idea of methods and instance variables as the
More informationCh 7 Designing Java Classes & Class structure. Fields have data values define/describe an instance
Ch 7 Designing Java Classes & Class structure Classes comprise fields and methods Fields have data values define/describe an instance Constructors values are assigned to fields when an instance/object
More informationIntroduction to Classes and Objects
3 Nothing can have value without being an object of utility. Karl Marx Your public servants serve you right. Adlai E. Stevenson Knowing how to answer one who speaks, To reply to one who sends a message.
More information12/22/11. Java How to Program, 9/e. Help you get started with Eclipse and NetBeans integrated development environments.
Java How to Program, 9/e Education, Inc. All Rights Reserved. } Java application programming } Use tools from the JDK to compile and run programs. } Videos at www.deitel.com/books/jhtp9/ Help you get started
More informationPrograms as Models. Procedural Paradigm. Class Methods. CS256 Computer Science I Kevin Sahr, PhD. Lecture 11: Objects
CS256 Computer Science I Kevin Sahr, PhD Lecture 11: Objects 1 Programs as Models remember: we write programs to solve realworld problems programs act as models of the real-world problem to be solved one
More informationProtection Levels and Constructors The 'const' Keyword
Protection Levels and Constructors The 'const' Keyword Review: const Keyword Generally, the keyword const is applied to an identifier (variable) by a programmer to express an intent that the identifier
More informationObject Oriented Programming in C#
Introduction to Object Oriented Programming in C# Class and Object 1 You will be able to: Objectives 1. Write a simple class definition in C#. 2. Control access to the methods and data in a class. 3. Create
More informationCh 7 Designing Java Classes & Class structure. Methods: constructors, getters, setters, other e.g. getfirstname(), setfirstname(), equals()
Ch 7 Designing Java Classes & Class structure Classes comprise fields and methods Fields: Things that describe the class or describe instances (i.e. objects) e.g. last student number assigned, first name,
More informationComputational Expression
Computational Expression ArrayList Iterators Janyl Jumadinova 7-14 November, 2018 Janyl Jumadinova Computational Expression 7-14 November, 2018 1 / 11 Collections Collection: an object that stores data;
More informationDeclarations and Access Control SCJP tips
Declarations and Access Control www.techfaq360.com SCJP tips Write code that declares, constructs, and initializes arrays of any base type using any of the permitted forms both for declaration and for
More informationHow to define your own classes that implement abstractions. How to pass information to methods and how methods return values.
CHAPTER Defining classes LEARNING OBJECTIVES By the end of this chapter you will understand the following: How to define your own classes that implement abstractions. How to declare, initialize and use
More informationNews and information! Review: Java Programs! Feedback after Lecture 2! Dead-lines for the first two lab assignment have been posted.!
True object-oriented programming: Dynamic Objects Reference Variables D0010E Object-Oriented Programming and Design Lecture 3 Static Object-Oriented Programming UML" knows-about Eckel: 30-31, 41-46, 107-111,
More informationCOMP 250: Java Programming I. Carlos G. Oliver, Jérôme Waldispühl January 17-18, 2018 Slides adapted from M. Blanchette
COMP 250: Java Programming I Carlos G. Oliver, Jérôme Waldispühl January 17-18, 2018 Slides adapted from M. Blanchette Variables and types [Downey Ch 2] Variable: temporary storage location in memory.
More informationCSSE 220. Interfaces and Polymorphism. Check out Interfaces from SVN
CSSE 220 Interfaces and Polymorphism Check out Interfaces from SVN Interfaces What, When, Why, How? What: Code Structure used to express operations that multiple class have in common No method implementations
More information