02/14/2005 Introduction to Programming with Java, for Beginners Midterm 1 Review.

Slides:



Advertisements
Similar presentations
Introduction to Java 2 Programming Lecture 3 Writing Java Applications, Java Development Tools.
Advertisements

JAVA Revision Lecture Electronic Voting System Marina De Vos.
Arrays.
CSCI 160 Midterm Review Rasanjalee DM.
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
Local Variables and Scope Benjamin Fein. Variable Scope A variable’s scope consists of all code blocks in which it is visible. A variable is considered.
CS0007: Introduction to Computer Programming Introduction to Classes and Objects.
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
July 13 th.  If/ Else if / Else  Variable Scope  Nested if/else's  Switch statements  Conditional Operator.
Syntax & terminology review While the following slides are not exactly what we did on the board (object diagrams are not shown here) they cover most of.
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
CSE 115/503 Introduction to Computer Science for Majors I1 Example Dog fido = new Dog(new Collar()); Dog rover = new Dog(new Collar()); rover.setCollar(fido.getCollar());
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall Office hours: M-F 11:00-11:
CSE 115 Week 11 March , Announcements March 26 – Exam 7 March 26 – Exam 7 March 28 – Resign Deadline March 28 – Resign Deadline Lab 7 turned.
Road Map Introduction to object oriented programming. Classes
Java Programming, 3e Concepts and Techniques Chapter 5 Arrays, Loops, and Layout Managers Using External Classes.
1 Chapter 4 Language Fundamentals. 2 Identifiers Program parts such as packages, classes, and class members have names, which are formally known as identifiers.
Week 10 Recap CSE 115 Spring For-each loop When we have a collection and want to do something to all elements of that collection we use the for-each.
Terms and Rules Professor Evan Korth New York University (All rights reserved)
Slides prepared by Rose Williams, Binghamton University Chapter 6 Arrays.
Review Java.
Understanding class definitions Looking inside classes.
Fall 2005CSE 115/503 Introduction to Computer Science I1 Composition details Recall, composition involves 3 things: –Declaration of instance variable of.
David Streader Computer Science Victoria University of Wellington Copyright: David Streader, Victoria University of Wellington Objects Real and Java COMP.
Programming in Java; Instructor:Moorthy Introduction, Objects, Classes, Libraries1 Programming in Java Introduction.
3.1 Documentation & Java Language Elements Purpose of documentation Assist the programmer with developing the program Assist other programers who.
Introduction to Java Appendix A. Appendix A: Introduction to Java2 Chapter Objectives To understand the essentials of object-oriented programming in Java.
CSC 212 – Data Structures Lecture 12: Java Review.
By Nicholas Policelli An Introduction to Java. Basic Program Structure public class ClassName { public static void main(String[] args) { program statements.
Classes CS 21a: Introduction to Computing I First Semester,
5-Aug-2002cse Arrays © 2002 University of Washington1 Arrays CSE 142, Summer 2002 Computer Programming 1
Chapter 10 Defining Classes. The Internal Structure of Classes and Objects Object – collection of data and operations, in which the data can be accessed.
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
CS0007: Introduction to Computer Programming Classes: Documentation, Method Overloading, Scope, Packages, and “Finding the Classes”
90-723: Data Structures and Algorithms for Information Processing Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 1: Introduction Data.
1 Chapter 5: Defining Classes. 2 Basics of Classes An object is a member of a class type What is a class? Fields & Methods Types of variables: –Instance:
CreatingClasses-SlideShow-part31 Creating Classes part 3 Barb Ericson Georgia Institute of Technology Dec 2009.
Spring 2009 Programming Fundamentals I Java Programming XuanTung Hoang Lecture No. 8.
 Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in memory. 
01/24/2005 Introduction to Programming with Java, for Beginners A Closer Look at Constructors and Methods.
5.1 Basics of defining and using classes A review of class and object definitions A class is a template or blueprint for an object A class defines.
OOP Basics Classes & Methods (c) IDMS/SQL News
Dale Roberts Object Oriented Programming using Java - Getters and Setters Dale Roberts, Lecturer Computer Science, IUPUI
JAVA Programming (Session 2) “When you are willing to make sacrifices for a great cause, you will never be alone.” Instructor: รัฐภูมิ เถื่อนถนอม
02/09/2005 Introduction to Programming with Java, for Beginners Arrays (of primitives)
CS/ENGRD 2110 FALL 2013 Lecture 3: Fields, getters and setters, constructors, testing 1.
Review A program is… a set of instructions that tell a computer what to do. Programs can also be called… software. Hardware refers to… the physical components.
CONDITIONALS CITS1001. Scope of this lecture if statements switch statements Source ppts: Objects First with Java - A Practical Introduction using BlueJ,
Memory Management in Java Mr. Gerb Computer Science 4.
Review for Test2. Scope 8 problems, 60 points. 1 Bonus problem (5 points) Coverage: – Test 1 coverage – Exception Handling, Switch Statement – Array of.
Objects as a programming concept
Chapter 3: Using Methods, Classes, and Objects
Methods The real power of an object-oriented programming language takes place when you start to manipulate objects. A method defines an action that allows.
Understanding class definitions
Control Structures (Structured Programming) for controlling the procedural aspects of programming CS1110 – Kaminski.
Class Structure 16-Nov-18.
Class Structure 7-Dec-18.
Sridhar Narayan Java Basics Sridhar Narayan
Class Structure 2-Jan-19.
Defining Classes and Methods
Computer Science Core Concepts
Class Structure 25-Feb-19.
Introduction to Object-Oriented Programming
Classes, Objects and Methods
Control Structures (Structured Programming) for controlling the procedural aspects of programming CS1110 – Kaminski.
Javascript Chapter 19 and 20 5/3/2019.
IAT 800 Foundations of Computational Art and Design
String Class.
Presentation transcript:

02/14/2005 Introduction to Programming with Java, for Beginners Midterm 1 Review

02/14/2005CSE 1101 Overview A Java program is a collection of cooperating objects An object is an instance of a class All Java code exists within a class Top Down Design Analyze the problem/simulation/game Decide what classes to use to model it Bottom Up Programming Write code for a class/method a little at a time

02/14/2005CSE 1102 Object “state” and “behavior” An object has “state” Instance variables that hold its data An object has “behavior” Methods that perform actions like computations, reporting information about state (“getters”), changing state (“setters”)

02/14/2005CSE 1103 Protecting an Object’s State A software designer wants his/her objects to behave: Consistently and reliably According to “spec” (specification) True to its documentation (javadocs) This is accomplished in part by: Making instance variables private Providing public methods that access the state appropriately

02/14/2005CSE 1104 Object Creation An object is an instance of a class A class has one or more constructors A constructor: Is a piece of code with the same name as the class Is executed when an object is created with the “new” operator When the “new” operator is used, Java finds the right class and then runs the constructor that has right number, order, and types of parameters

02/14/2005CSE 1105 Variables Variable Types Primitive Reference Variable Scope Instance Variable (a.k.a. “dynamic” variable, field) Method/constructor Parameters Local Variables

02/14/2005CSE 1106 Expressions An expression has a value. Some examples: Arithmetic X * 2 Relational >, >=, <, <=, ==, != Boolean true, false, &&, ||, ! Assignment (value is the value assigned) Method call (value is the value returned by method)

02/14/2005CSE 1107 Statements A statement causes an action. Statements end with a semicolon or a {block} Unlike an expression, a statement does not have a value Some examples: Variable declaration Assignment Method call if while for

02/14/2005CSE 1108 Arrays A way to easily declare many variables of the same type An array is an object Whenever you see [ ] in a Java/C/C++/C# program, that means array Provide random access Legal indices: 0 through (length - 1) If attempt to access via an illegal index: ArrayOutOfBoundsException