Clicker quiz 9/3/13 CSE 1102 Fall 2013. Look out behind you! The picture associated with one of the instructors on Piazza includes an animal. That animal.

Slides:



Advertisements
Similar presentations
1 Inheritance Chapter 9. 2 Module Outcomes To develop a subclass from a superclass through inheritance To invoke the superclass ’ s constructors and methods.
Advertisements

GUI and Swing, part 2 The illustrated edition. Scroll bars As we have previously seen, a JTextArea has a fixed size, but the amount of text that can be.
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.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Immutable Objects and Classes.
Week 4 Recap CSE 115 Spring Formal Parameter Lists Comma-separated list of formal parameters Formal parameters are listed giving the type of the.
Classes and Objects in Java
Java Syntax, Java Conventions, CSE 115 Conventions (Part 2) CSE 115 Spring 2006 January 30, February 1 & 3, 2006.
Week 5 Recap CSE 115 Spring Composition Informally called “has a” Represented in UML with a diamond- headed arc In code: Declare an instance variable.
Fall 2005CSE 115/503 Introduction to Computer Science I1 Composition details Recall, composition involves 3 things: –Declaration of instance variable of.
More Arrays Length, constants, and arrays of arrays By Greg Butler.
Chapter 4 Objects and Classes.
(C) 2010 Pearson Education, Inc. All rights reserved. Java™ How to Program, 8/e.
COP3502 Programming Fundamentals for CIS Majors 1 Instructor: Parisa Rashidi.
CSC 142 B 1 CSC 142 Java objects: a first view [Reading: chapters 1 & 2]
1 Object-Oriented Software Engineering CS Interfaces Interfaces are contracts Contracts between software groups Defines how software interacts with.
Copyright © 2014 by John Wiley & Sons. All rights reserved.1 Chapter 9 - Inheritance.
Java Quiz Bowl A fun review of the Java you should know from CMPT 201 If you don’t know the answers - this week is for you to study up!
How to Run a Java Program CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
How to Run a Java Program CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
Chapter 7 Objects and Classes 1 Fall 2012 CS2302: Programming Principles.
Interfaces. –An interface describes a set of methods: no constructors no instance variables –The interface must be implemented by some class. 646 java.
Copyright 2004 Scott/Jones Publishing Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 7 Structured Data and Classes.
Introduction to programming in the Java programming language.
First Programs CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
OOP: Encapsulation,Abstraction & Polymorphism. What is Encapsulation Described as a protective barrier that prevents the code and data being randomly.
Classes and Objects in Java
Programming in Java CSCI-2220 Object Oriented Programming.
SE-1010 Dr. Mark L. Hornick 1 Java Programming Basics.
24-Dec-15 Class Structure. 2 Classes A class describes a set of objects The objects are called instances of the class A class describes: Fields (instance.
1 COS 260 DAY 14 Tony Gauvin. 2 Agenda Questions? 6 th Mini quiz graded  Oct 29 –Chapter 6 Assignment 4 will be posted later Today –First two problems.
CMSC 202 Advanced Section Classes and Objects: Object Creation and Constructors.
Clicker quiz 10/8/13 CSE 1102 Fall 2013 (E-30 reminder!)
Arrays-. An array is a way to hold more than one value at a time. It's like a list of items.
Singleton Pattern. Problem Want to ensure a single instance of a class, shared by all uses throughout a program Context Need to address initialization.
Type Group Name Here Type the members of your group here **Choose your design to make your presentation interesting**
import java.util.Scanner; class myCode { public static void main(String[] args) { Scanner input= new Scanner(System.in); int num1; System.out.println(“Enter.
This In Java, the keyword this allows an object to refer to itself. Or, in other words, this refers to the current object – the object whose method or.
Clicker quiz 9/17/13 CSE 1102 Fall // In Blob: public void mousePressed(MouseEvent e){ this.setFillColor(java.awt.Color.blue); } // in WinkingBlob.
Adding and Eating Worms Mrs. C. Furman August 23, 2010.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Fall 2013 Chapter 10 Thinking.
Clicker quiz 10/1/13 CSE 1102 Fall public class Sun extends Ellipse { 2. public Sun(Color c) { 3. super(c); 4. … 5. } 6. public Sun() { 7. this(Color.yellow);
Programming in Java Transitioning from Alice. Becomes not myFirstMethod but …. public static void main (String[] arg) { // code for testing classes goes.
 The word static is used to declare either a ________ variable or method.  Why do we use statics?  What is Polymorphism? class In general, we use a.
Variable scope. Variable Scope Variables do not live forever. Failing to take that into account leads to problems. Let's look at an example. Let's write.
Gayle J Yaverbaum School of Business Administration Penn State Harrisburg Fall 2006 Object-Oriented Design and Program Development in Business INFSY
Topic: Classes and Objects
Class Inheritance Part I
OOP: Encapsulation &Abstraction
9.1 Class (static) Variables and Methods
Clicker quiz 10/1/13 CSE 1102 Fall 2013.
CompSci 230 Software Construction
Class Structure 16-Nov-18.
CSC 113 Tutorial QUIZ I.
Inheritance, Polymorphism, and Interfaces. Oh My
Class Structure 28-Nov-18.
Class Structure 7-Dec-18.
METHOD OVERRIDING in JAVA
Class Structure 2-Jan-19.
Today’s topics UML Diagramming review of terms
L.O. place the learning objective here
Anatomy of a Java Program
Class Structure 25-Feb-19.
Which best describes the relationship between classes and objects?
Constructors, GUI’s(Using Swing) and ActionListner
CLASSES, AND OBJECTS A FIRST LOOK
Chapter 9 Carrano Chapter 10 Small Java
Chapter 14 Abstract Classes and Interfaces
Sampath Kumar S Assistant Professor, SECE
Chapter 11 Inheritance and Polymorphism Part 1
Classes and Objects Object Creation
Presentation transcript:

Clicker quiz 9/3/13 CSE 1102 Fall 2013

Look out behind you! The picture associated with one of the instructors on Piazza includes an animal. That animal is a … A.Horse B.Dog C.Bear [correct] D.Moose E.The instructor is the only animal in the picture

"The iguana is green. It lives in a cage, eats lettuce leaves from a food dish, and moves around the cage." Which of the above does not describe a capability of the iguana? A. The iguana is green [correct] B. It lives in a cage C. [It] eats lettuce leaves from a food dish D. [It] moves around the cage E. None of the above

An object's properties are modeled in Java by using A. Constructors B. Methods C. Instance variables [correct] D. Comments E. None of the above

1.public class Iguana { 2. // here model the properties and capabilities 3.} In line 1 of the above code, which words are reserved words? (the line numbers do not appear in the code, just on the slide to make it clearer) A. public and class [correct] B. public and Iguana C. class and Iguana D. public, class, and Iguana E. Java does not have any reserved words

Clicker questions 9/3/13 CSE 1102 Fall 2013

1.public class FirstApp extends wheels.users.Frame { 2. private wheels.users.Ellipse _ellipse; public FirstApp() { 5. _ellipse = new wheels.users.Ellipse(); 6. } public static void main(String[] args) { 9. FirstApp app = new FirstApp(); 10. } 11.} Why is the Ellipse named _ellipse, but the FirstApp named app? A.Since Ellipse is an externally defined class we need to use the underscore. B.Since we call the FirstApp app instead of firstApp we do not need the underscore. C._ellipse is an instance variable, but app is not [correct] D._ellipse needs to be used in more than one place but app does not E._ellipse is private, but app is not

This UML classs diagram specifies that A.Cage is a peer object of Bowl; B.Each Iguana is contained in a Cage C.Each instance of Iguana “knows about” an instance of Cage D.An Iguana can go to a Cage or to a Bowl E.Each Bowl and Cage has an assigned Iguana

In the Iguana class, the instance variables are private, but the methods are public. This policy is good in general because (choose the best answer): A.You want to hide the internal state of an object from the user B.Private methods don't make sense because you cannot invoke them C.Instance variables never change, so you do not have to provide access D.It allows you to control access using methods rather than variables [correct] E.It is a convention in this text, like putting underscore at the start of an instance variable name