The AP Java Subset Topics. A Topics Primitive Types int double boolean.

Slides:



Advertisements
Similar presentations
Object Oriented Programming with Java
Advertisements

Chapter 1 Object-Oriented Concepts. A class consists of variables called fields together with functions called methods that act on those fields.
Java Programming Abstract classes and Interfaces.
INTERFACES IN JAVA 1.Java Does not support Multiple Inheritance directly. Multiple inheritance can be achieved in java by the use of interfaces. 2.We need.
1 Inheritance Chapter 9. 2 Module Outcomes To develop a subclass from a superclass through inheritance To invoke the superclass ’ s constructors and methods.
Inheritance Inheritance Reserved word protected Reserved word super
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
CS 106 Introduction to Computer Science I 04 / 16 / 2010 Instructor: Michael Eckmann.
C#.NET C# language. C# A modern, general-purpose object-oriented language Part of the.NET family of languages ECMA standard Based on C and C++
1 Inheritance and Polymorphism. 2 Motivations Suppose you will define classes to model circles, rectangles, and triangles. These classes have many common.
Inheritance and interfaces A class C1 is derived from class C2, then C1 is called subclass, and C2 is called superclass Superclass-parent, base class Subclass.
CS102--Object Oriented Programming Review 1: Chapter 1 – Chapter 7 Copyright © 2008 Xiaoyan Li.
OOP in Java Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Differences between C# and C++ Dr. Catherine Stringfellow Dr. Stewart Carpenter.
Principles of Computer Programming (using Java) Review Haidong Xue Summer 2011, at GSU.
Chapter 11 Abstract Classes and Interfaces 1. Abstract method New modifier for class and method: abstract An abstract method has no body Compare: abstract.
COP 2800 Lake Sumter State College Mark Wilson, Instructor.
COP INTERMEDIATE JAVA Designing Classes. Class Template or blueprint for creating objects. Their definition includes the list of properties (fields)
Lecture objectives  Differences between Java and C#  Understand and use abstract classes  Casting in Java: why is it important?  Master exceptions.
APCS Java AB 2004 Review of CS1 and CS2 Review for AP test #1 Sources: 2003 Workshop notes from Chris Nevison (Colgate University) AP Study Guide to go.
1 Java: AP Curriculum Focus and Java Subset Alyce Brady.
Hello.java Program Output 1 public class Hello { 2 public static void main( String [] args ) 3 { 4 System.out.println( “Hello!" ); 5 } // end method main.
The java.lang Package chapter 8 Java Certification Study Group February 2, 1998 Seth Ladd.
AP Computer Science A – Healdsburg High School 1 Interfaces, Abstract Classes and the DanceStudio - Similarities and Differences between Abstact Classes.
15440 Distributed Systems Recitation 1 Objected-Oriented Java Programming.
Page: 1 การโปรแกรมเชิงวัตถุด้วยภาษา JAVA บุรินทร์ รุจจนพันธุ์.. ปรับปรุง 15 มิถุนายน 2552 Keyword & Data Type มหาวิทยาลัยเนชั่น.
Chapter 3 Inheritance and Polymorphism Goals: 1.Superclasses and subclasses 2.Inheritance Hierarchy 3.Polymorphism 4.Type Compatibility 5.Abstract Classes.
1 JAVA API & Packages Starring: Java Documentation Co-Starring: BlueJ IDE.
Some Standard Classes Goals The Object class The String class Wrapper classes The Math class Random Numbers.
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
Chapter 14 Abstract Classes and Interfaces. Abstract Classes An abstract class extracts common features and functionality of a family of objects An abstract.
Abstract Classes and Interfaces Chapter 9 CSCI 1302.
COP INTERMEDIATE JAVA Designing Classes. Class Template or blueprint for creating objects. Their definition includes the list of properties (fields)
Chapter 5 Objects and Classes Inheritance. Solution Assignments 3 & 4 Review in class…..
CMSC 341 Java Packages, Classes, Variables, Expressions, Flow Control, and Exceptions.
Java Class Structure. Class Structure package declaration import statements class declaration class (static) variable declarations* instance variable.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 9 Inheritance and.
UMass Lowell Computer Science Java and Distributed Computing Prof. Karen Daniels Fall, 2000 Lecture 9 Java Fundamentals Objects/ClassesMethods Mon.
Chapter 7: Class Inheritance F Superclasses and Subclasses F Keywords: super and this F Overriding methods F The Object Class F Modifiers: protected, final.
Chapter 8 Class Inheritance and Interfaces F Superclasses and Subclasses  Keywords: super F Overriding methods  The Object Class  Modifiers: protected,
Application development with Java Lecture 21. Inheritance Subclasses Overriding Object class.
Chapter 11: Advanced Inheritance Concepts. Objectives Create and use abstract classes Use dynamic method binding Create arrays of subclass objects Use.
Quick Review of OOP Constructs Classes:  Data types for structured data and behavior  fields and methods Objects:  Variables whose data type is a class.
© 2006 Pearson Addison-Wesley. All rights reserved 1-1 Chapter 1 Review of Java Fundamentals.
1 Object-Oriented Programming Inheritance. 2 Superclasses and Subclasses Superclasses and Subclasses  Superclasses and subclasses Object of one class.
Terms and Rules II Professor Evan Korth New York University (All rights reserved)
Reference Types CSE301 University of Sunderland Harry R Erwin, PhD.
Lecture 5:Interfaces and Abstract Classes Michael Hsu CSULA.
UMass Lowell Computer Science Java and Distributed Computing Prof. Karen Daniels Fall, 2000 Lecture 10 Java Fundamentals Objects/ClassesMethods.
JAVA ACCESS MODIFIERS. Access Modifiers Access modifiers control which classes may use a feature. A classes features are: - The class itself - Its member.
Classes CS 162 (Summer 2009). Parts of a Class Instance Fields Methods.
Lecture 6:Interfaces and Abstract Classes Michael Hsu CSULA.
Objects and Classes. F OO Programming Concepts F Creating Objects and Object Reference Variables –Differences between primitive data type and object type.
Lecture 5:Interfaces and Abstract Classes
Object-Oriented Concepts
CSC 243 – Java Programming, Spring 2014
Chapter 11 Inheritance and Polymorphism
Objects as a programming concept
Inheritance and Polymorphism
Inheritance, Polymorphism, and Interfaces. Oh My
Computer Science II Exam 1 Review.
Overloading and Constructors
Chapter 9 Inheritance and Polymorphism
null, true, and false are also reserved.
The Building Blocks Classes: Java class library, over 1,800 classes:
Abstract Class As per dictionary, abstraction is the quality of dealing with ideas rather than events. For example, when you consider the case of ,
CSC 220 – Processing Spring, 2017
Creating and Modifying Text part 3
Agenda Types and identifiers Practice Assignment Keywords in Java
Overloading Each method has a signature: its name together with the number and types of its parameters Methods Signatures String toString()
Presentation transcript:

The AP Java Subset Topics

A Topics

Primitive Types int double boolean

Operators +, -, *, /, % ++, -- = +=, -=, *=, /=, %= ==, !=,, = &&, ||, !

Numeric Casts (int) (double)

String Concatenation + will convert numbers to strings and invoke the toString() method on objects

Escape Sequences \\ \” \n

Input & Output INPUT IS NOT TESTED Output is restricted to System.out.print and println Formatting output is not tested

Arrays One-dimensional Arrays of primitive types & of objects Initialization of named arrays: – int[] array = {1, 3, 6, 9};

Control Structures if if/else while for return (do/while, switch, continue, break – not tested)

Method Overloading Understand signature of method Depends on number, types & order of parameters Does not depend on return type of method

Classes Construct objects with new operator Supply constructor parameters Invoke accessor & modifier methods Modify existing classes Design own classes

Visibility All classes will be public All instance variable will be private Methods, constructors and constants are either public or private NO protected

Comments // single line comments /* */ block comments No Javadoc comments

Final & Static final keyword is used for final block scope constants static final class scope constants static methods static final variables NO – final parameters, final methods, final classes, static variables

null & this null reference is in the Java subset this is restricted to passing an implicit parameter in its entirety to another method (obj.method(this)) Descriptions such as “the implicit parameter this”

Super Use to invoke superclass constructor – ex: super(args); Or to invoke superclass method – ex: super.method(args);

Constructors Be able to implement Initialize all instance variables Don’t need to know default rules

Extend & Implement extend classes implement interfaces Know inheritance!!!

Read and Understand Be able to read definitions of interfaces and abstract classes Understand that the abstract methods need to be redefined for non-abstract classes Write interfaces or class declarations when given a general description of the interface or class

Equals Know when to use == or.equals Objects: equals Identity: ==

Subclass to Superclass No casting is needed to convert from a subclass to a superclass Do need to know class casts: – ArrayList xx = new ArrayList(); – yy = (yyclass)xx.get(i);

Packages import statement import package.subpackage.class;

Exceptions NullPointerException ArrayIndexOutOfBoundsException ArithmeticException ClassCastException IllegalArgumentException

Standard Library Methods java.lang.Object – equals – toString java.lang.Comparable – compareTo java.lang.Integer – Integer(int value) //constructor – intValue – equals – toString – compareTo

Standard Library Methods (cont’d) java.lang.Double – Double(double value) //constructor – doubleValue – equals – toString – compareTo java.lang.String – compareTo – equals – length – substring – indexOf

Standard Library Methods (cont’d) java.lang.Math – abs (for int and double) – pow – sqrt java.util.Random – nextInt – nextDouble

Standard Library Methods (cont’d) java.util.ArrayList – size – add – get – set – remove

AB Topics

Two-dimensional Arrays Ragged arrays are not tested – int [][] x = new int[3][]; Don’t need to know int[3][3] is an array of arrays Know that x[0].length is the number of columns in a rectangular two-dimensional array named x

Abstract Classes AB students are expected to design own interfaces and abstract classes

Throwing Unchecked Exceptions IllegalStateException NoSuchElementException

Standard Library Methods java.lang.Object – equals – toString – hashCode java.lang.Comparable – compareTo java.lang.Integer – Integer(int value) //constructor – intValue – equals – toString – compareTo

Standard Library Methods (cont’d) java.lang.Double – Double(double value) //constructor – doubleValue – equals – toString – compareTo java.lang.String – compareTo – equals – length – substring – indexOf

Standard Library Methods (cont’d) java.lang.Math – abs (for int and double) – pow – sqrt java.util.Random – nextInt – nextDouble

Standard Library Methods (cont’d) java.util.List – add – size – get – set – iterator – listIterator java.util.ArrayList – All List methods – add – remove

Standard Library Methods (cont’d) java.util.LinkedList – addFirst – addLast – getFirst – getLast – removeFirst – removeLast

Standard Library Methods (cont’d) java.util.Set – add – contains – remove – size – iterator java.util.HashSet java.util.TreeSet

Standard Library Methods (cont’d) java.util.Map – put – get – remove – containsKey – size – keySet java.util.HashMap java.util.TreeMap

Standard Library Methods (cont’d) java.util.Iterator – hasNext – next – remove Java.util.ListIterator – add – set

Online resources Acorn online Java API