Advanced OOP Concepts in Java
|
|
|
- Eugenia Hudson
- 9 years ago
- Views:
Transcription
1 Advanced OOP Concepts in Java Michael B. Spring Department of Information Science and Telecommunications University of Pittsburgh 09/28/2001 1
2 Overview of Part 1 of the Course Demystifying Java: Simple Code Introduction to Java An Example of OOP in practice Object Oriented Programming Concepts OOP Concepts -- Advanced Hints and for Java I/O (Streams) in Java Graphical User Interface Coding in Java Exceptions and Exception handling This slide set
3 Overview of this Slide Set Nested Classes Inner Classes Member Classes Local Classes Anonymous Classes
4 Nested classes and Inner classes Introduction: a taxonomy Nested top-level classes (and interfaces) -.class files and JVM Inner classes Member class Local class Containment hierarchy Anonymous class Visibility / Access 4
5 Introduction: nested classes Java 1.0 allowed class declaration only at the package level. Class names are therefore organized into packages, each having its own name space. These are called top-level classes. Java 1.1 allows class (and interface) declaration within the class scope, nested inside the definition of another class. These are called nested classes, and nested interfaces. Nested interfaces are always static. Nested classes may or may not be static. Static nested classes and interfaces are functionally top-level classes, but non-static nested classes are inner classes. 5
6 Introduction: a taxonomy top-level classes and interfaces: 1) package level class or interface 2) static class or interface nested in class scope. inner classes: member class declared as a member of the containing class; local class declared as a local variable within a method body of the containing class; anonymous class local class with no declaration (and therefore no name), but an instance can be created. 6
7 Nested top-level class & interface Nested top-level class must be declared static. Nested top-level interface is always static. Being static, it is functionally same as top-level. It is conveniently nested so that it does not clutter the package level name space, often used in a helper class such as an iterator designed for some data structure. 7
8 Nested top-level class & interface Nested top-level class & interface interface Link { public Link getnext(); public void setnext(link node); class Node implements Link { int i; private Link next; public Node(int i) { this.i = i; public Link getnext() { return next; public void setnext(link node) { next = node; public class LinkedList { private Link head; public void insert(link node) { ; public void remove(link node) { ; Link is an interface for nodes of a linked list, let us define it inside the class scope oflinkedlist. 8
9 Nested top-level class & interface Nested top-level class & interface public class LinkedList { public interface Link { public Link getnext(); public void setnext(link node); private Link head; public void insert(link node) { ; public void remove(link node) { ; class Node implements LinkedList.Link { int i; private LinkedList.Link next; public Node(int i) { this.i = i; public LinkedList.Link getnext() { return next; public void setnext(linkedlist.link node) { next = node; 9
10 Nested top-level class & interface Note how we may import a static nested class import LinkedList.*; // Import nested classes. class Node implements Link { private int i; private Link next; public Node(int i) { this.i = i; public Link getnext() { return next; public void setnext(link node) { next = node; 10
11 -.class files and JVM When we compile a Java source (-.java) file with nested class defined, note the class (-.class) files generated. When we compile LinkedList.java, we generate LinkedList.class LinkedList$Link.class The Java Virtual Machine (JVM) knows nothing about nested classes. But the Java compiler uses the $ insertion to control the class name space so that JVM would interpret the -.class files correctly. 11
12 Inner Classes Nested classes which are not static are called inner classes. They appear in these ways: member class declared as a member of the containing class; local class declared as a local variable within a method body of the containing class; anonymous class local class with no declaration (and therefore no name), but an instance can be created. An inner class is therefore associated with the containing class in which it is defined. 12
13 Inner Classes Examples class A { ; class B { class MC { ; // Example of Member Class: MC public void meth( ) { class LC { ; // Example of Local Class: LC // creating an object of an Anonymous Class // which is a subclass of A. A a = new A() { void meth( ) { ; // An inner class is associated with a containing class. // Each inner class object is also associated with an // object of the containing class.
14 Member Class Use a member class (instead of a nested top-level class) when the member class needs access to the instance fields of the containing class. Consider the LinkedList class we had before. If we have a linked-list (a LinkedList object), and we want to have an enumerator (an Enumerator object) to iterate through the elements in the linked-list, the Enumerator object must be associated with the LinkedList object. Let us first define the LinkedListEnumerator as a helper class at the top-level, and then make it into a Member Class within the LinkedList class.
15 LinkedList and Enumerator public class LinkedList { public interface Link { public Link getnext(); public void setnext(link node); private Link head; // helper class cannot get to head. public Link gethead() { return head; // added. public void insert(link node) { ; public void remove(link node) { ; class Node implements LinkedList.Link { int i; private LinkedList.Link next; public Node(int i) { this.i = i; public LinkedList.Link getnext() { return next; public void setnext(linkedlist.link node) { next = node;
16 LinkedList and Enumerator class LinkedListEnumerator { private LinkedList list; private LinkedList.Link current; public LinkedListEnumerator(LinkedList ll) { list = ll; current = list.gethead(); public boolean hasmoreelements() { return( current!= null ); public LinkedList.Link nextelement() { LinkedList.Link node = current; current = current.getnext(); return node; Observe that LinkedListEnumerator is a helper class; each of its object is associated with a LinkedList object (ref: constructor); we then want to make it into a Member Class within the LinkedList Class
17 LinkedList and Enumerator public class LinkedList { public interface Link { public Link getnext(); public void setnext(link node); private Link head; // helper class can get to head now... public void insert(link node) { ; public void remove(link node) { ; public class Enumerator { private Link current; public Enumerator() { current = head; public boolean hasmoreelements() { return( current!= null ); public Link nextelement() { Link node = current; current = current.getnext(); return node;
18 Member Class Member class methods have access to all fields and methods of the containing class. In the Member class method definition, a field/method name is resolved first in the local scope, and then the class scopes first the inherited classes and then the containment classes, unless there is explicit scope specified. Explicit access: <ClassName>.this.<FieldName> A Member Class cannot be named the same as one of its containing classes. A Member Class cannot have static fields/methods.
19 Member Class: accessing fields public class A { public String name = A"; public class B { public String name = B"; public class C { public String name = C"; public void print_names() { System.out.println(name); System.out.println(this.name); System.out.println(C.this.name); System.out.println(B.this.name); System.out.println(A.this.name); // prints out: C A a = new A(); // C A.B b = a.new B(); // C A.B.C c = b.new C(); // B c.print_names(); // A
20 Local Class A Local Class is a class declared and defined within the local scope (like a local variable) of a method definition of the containing class. The class name is only visible within the local scope. A Local Class is similar to a Member Class and must obey all the restriction of a Member Class but the methods of a local class cannot access other local variables within the block except when they are final. A Local Class cannot be declared public, private, protected, or static. Common use of local classes is for event listeners in Java 1.1, using the new AWT event model.
21 Local Class example class A { protected char a = 'A'; class B { protected char b = 'B'; public class C extends A { private char c = 'C'; public static char d = 'D'; public void createlocalobject(final char e) { final char f = 'F'; int i = 0; class LocalClass extends B { char g = 'G'; public void printvars() { System.out.print(g); // (this.g) of this class System.out.print(f); // f final local variable System.out.print(e); // e final local variable System.out.print(d); // (C.this.d) containing class System.out.print(c); // (C.this.c) containing class System.out.print(b); // b inherited from B System.out.print(a); // a inherited from A LocalClass lc = new LocalClass(); lc.printvars(); public static void main(string[] as) { C c = new C(); c.createlocalobject('e'); // prints out: GFEDCBA
22 Anonymous Class An Anonymous Class is essentially a local class without a name. Instead of defining a local class and then create an instance (probably the only object) of the class for use, Anonymous Class does that in just one step. An Anonymous Class must then also obey all the restrictions of a local class, except that in using new syntax, an Anonymous Class is defined at the point an instance of the class is created. Common use of anonymous classes is in the adapter classes used as event listeners in GUI programming using the AWT event model.
23 Anonymous Class: an example import java.io.*; public class Lister { public static void main(string[] arg) { File f = new File(arg[0]); Class JavaFilter extends FilenameFilter { public boolean accept(file f, String s) { return( s.endswith(.java ); JavaFilter jfilter = new JavaFilter(); String[] list = f.list(jfilter); for (int i=0; i < list.length; i++) System.out.println(list[i]);
24 Anonymous Class: an example import java.io.*; public class Lister { public static void main(string[] arg) { File f = new File(arg[0]); String[] list = f.list( new FilenameFilter() { public boolean accept(file f, String s) { return( s.endswith(.java ); ); for (int i=0; i < list.length; i++) System.out.println(list[i]);
25 Anonymous Class Some style guidelines for using anonymous class: The class has a very short body. Only one instance of the class is needed at a time. The class is used immediately after it is defined. A name for the class does not make the code easier to understand. Since an anonymous class has no name, it is not possible to define a constructor. Java 1.1 has a new feature instance initializer to conveniently initialize the object created for an anonymous class. But the feature applies to all classes.
26 Instance Initializer An instance initializer is a block of code (inside braces) embedded in a class definition, where we normally have definition of fields and methods. public class InitializerDemo { public int[] array; { array = new int[10]; for (int i=0; i<10; ++i) array[i] = i; There can be more than one instance initializer in the class definition. The instance initializers are executed in order, after the superclass constructor has returned, before the constructor of the current class is called.
27 Exercise Provided: an abstract which defines a banking account with its abstract class. To do: write a program that subclasses the abstract class, defines the abstract methods, and provides some additional functionality. 27
28
AP Computer Science Java Subset
APPENDIX A AP Computer Science Java Subset The AP Java subset is intended to outline the features of Java that may appear on the AP Computer Science A Exam. The AP Java subset is NOT intended as an overall
Fundamentals of Java Programming
Fundamentals of Java Programming This document is exclusive property of Cisco Systems, Inc. Permission is granted to print and copy this document for non-commercial distribution and exclusive use by instructors
Java (12 Weeks) Introduction to Java Programming Language
Java (12 Weeks) Topic Lecture No. Introduction to Java Programming Language 1 An Introduction to Java o Java as a Programming Platform, The Java "White Paper" Buzzwords, Java and the Internet, A Short
Java Interview Questions and Answers
1. What is the most important feature of Java? Java is a platform independent language. 2. What do you mean by platform independence? Platform independence means that we can write and compile the java
Masters programmes in Computer Science and Information Systems. Object-Oriented Design and Programming. Sample module entry test xxth December 2013
Masters programmes in Computer Science and Information Systems Object-Oriented Design and Programming Sample module entry test xxth December 2013 This sample paper has more questions than the real paper
The Java Series. Java Essentials I What is Java? Basic Language Constructs. Java Essentials I. What is Java?. Basic Language Constructs Slide 1
The Java Series Java Essentials I What is Java? Basic Language Constructs Slide 1 What is Java? A general purpose Object Oriented programming language. Created by Sun Microsystems. It s a general purpose
LAB4 Making Classes and Objects
LAB4 Making Classes and Objects Objective The main objective of this lab is class creation, how its constructer creation, object creation and instantiation of objects. We will use the definition pane to
Computing Concepts with Java Essentials
2008 AGI-Information Management Consultants May be used for personal purporses only or by libraries associated to dandelon.com network. Computing Concepts with Java Essentials 3rd Edition Cay Horstmann
Java from a C perspective. Plan
Java from a C perspective Cristian Bogdan 2D2052/ingint04 Plan Objectives and Book Packages and Classes Types and memory allocation Syntax and C-like Statements Object Orientation (minimal intro) Exceptions,
Part I. Multiple Choice Questions (2 points each):
Part I. Multiple Choice Questions (2 points each): 1. Which of the following is NOT a key component of object oriented programming? (a) Inheritance (b) Encapsulation (c) Polymorphism (d) Parallelism ******
Free Java textbook available online. Introduction to the Java programming language. Compilation. A simple java program
Free Java textbook available online "Thinking in Java" by Bruce Eckel, 4th edition, 2006, ISBN 0131872486, Pearson Education Introduction to the Java programming language CS 4354 Summer II 2015 The third
Free Java textbook available online. Introduction to the Java programming language. Compilation. A simple java program
Free Java textbook available online "Thinking in Java" by Bruce Eckel, 4th edition, 2006, ISBN 0131872486, Pearson Education Introduction to the Java programming language CS 4354 Summer II 2014 Jill Seaman
An Overview of Java. overview-1
An Overview of Java overview-1 Contents What is Java Major Java features Java virtual machine Java programming language Java class libraries (API) GUI Support in Java Networking and Threads in Java overview-2
History OOP languages Year Language 1967 Simula-67 1983 Smalltalk
History OOP languages Intro 1 Year Language reported dates vary for some languages... design Vs delievered 1957 Fortran High level programming language 1958 Lisp 1959 Cobol 1960 Algol Structured Programming
Software Engineering Techniques
Software Engineering Techniques Low level design issues for programming-in-the-large. Software Quality Design by contract Pre- and post conditions Class invariants Ten do Ten do nots Another type of summary
Chapter 1 Fundamentals of Java Programming
Chapter 1 Fundamentals of Java Programming Computers and Computer Programming Writing and Executing a Java Program Elements of a Java Program Features of Java Accessing the Classes and Class Members The
Introduction to Java Applications. 2005 Pearson Education, Inc. All rights reserved.
1 2 Introduction to Java Applications 2.2 First Program in Java: Printing a Line of Text 2 Application Executes when you use the java command to launch the Java Virtual Machine (JVM) Sample program Displays
qwertyuiopasdfghjklzxcvbnmqwerty uiopasdfghjklzxcvbnmqwertyuiopasd fghjklzxcvbnmqwertyuiopasdfghjklzx cvbnmqwertyuiopasdfghjklzxcvbnmq
qwertyuiopasdfghjklzxcvbnmqwerty uiopasdfghjklzxcvbnmqwertyuiopasd fghjklzxcvbnmqwertyuiopasdfghjklzx cvbnmqwertyuiopasdfghjklzxcvbnmq Introduction to Programming using Java wertyuiopasdfghjklzxcvbnmqwertyui
JAVA - FILES AND I/O
http://www.tutorialspoint.com/java/java_files_io.htm JAVA - FILES AND I/O Copyright tutorialspoint.com The java.io package contains nearly every class you might ever need to perform input and output I/O
Java 6 'th. Concepts INTERNATIONAL STUDENT VERSION. edition
Java 6 'th edition Concepts INTERNATIONAL STUDENT VERSION CONTENTS PREFACE vii SPECIAL FEATURES xxviii chapter i INTRODUCTION 1 1.1 What Is Programming? 2 J.2 The Anatomy of a Computer 3 1.3 Translating
Introduction to Java
Introduction to Java The HelloWorld program Primitive data types Assignment and arithmetic operations User input Conditional statements Looping Arrays CSA0011 Matthew Xuereb 2008 1 Java Overview A high
Arrays. Atul Prakash Readings: Chapter 10, Downey Sun s Java tutorial on Arrays: http://java.sun.com/docs/books/tutorial/java/nutsandbolts/arrays.
Arrays Atul Prakash Readings: Chapter 10, Downey Sun s Java tutorial on Arrays: http://java.sun.com/docs/books/tutorial/java/nutsandbolts/arrays.html 1 Grid in Assignment 2 How do you represent the state
Introduction to Object-Oriented Programming
Introduction to Object-Oriented Programming Programs and Methods Christopher Simpkins [email protected] CS 1331 (Georgia Tech) Programs and Methods 1 / 8 The Anatomy of a Java Program It is customary
Java Programming Fundamentals
Lecture 1 Part I Java Programming Fundamentals Topics in Quantitative Finance: Numerical Solutions of Partial Differential Equations Instructor: Iraj Kani Introduction to Java We start by making a few
Object-Oriented Design Lecture 4 CSU 370 Fall 2007 (Pucella) Tuesday, Sep 18, 2007
Object-Oriented Design Lecture 4 CSU 370 Fall 2007 (Pucella) Tuesday, Sep 18, 2007 The Java Type System By now, you have seen a fair amount of Java. Time to study in more depth the foundations of the language,
C++ INTERVIEW QUESTIONS
C++ INTERVIEW QUESTIONS http://www.tutorialspoint.com/cplusplus/cpp_interview_questions.htm Copyright tutorialspoint.com Dear readers, these C++ Interview Questions have been designed specially to get
SE 360 Advances in Software Development Object Oriented Development in Java. Polymorphism. Dr. Senem Kumova Metin
SE 360 Advances in Software Development Object Oriented Development in Java Polymorphism Dr. Senem Kumova Metin Modified lecture notes of Dr. Hüseyin Akcan Inheritance Object oriented programming languages
GUIs with Swing. Principles of Software Construction: Objects, Design, and Concurrency. Jonathan Aldrich and Charlie Garrod Fall 2012
GUIs with Swing Principles of Software Construction: Objects, Design, and Concurrency Jonathan Aldrich and Charlie Garrod Fall 2012 Slides copyright 2012 by Jeffrey Eppinger, Jonathan Aldrich, William
Android Application Development Course Program
Android Application Development Course Program Part I Introduction to Programming 1. Introduction to programming. Compilers, interpreters, virtual machines. Primitive data types, variables, basic operators,
CSCI 253. Object Oriented Programming (OOP) Overview. George Blankenship 1. Object Oriented Design: Java Review OOP George Blankenship.
CSCI 253 Object Oriented Design: Java Review OOP George Blankenship George Blankenship 1 Object Oriented Programming (OOP) OO Principles Abstraction Encapsulation Abstract Data Type (ADT) Implementation
Introducing Variance into the Java Programming Language DRAFT
Introducing Variance into the Java Programming Language A Quick Tutorial DRAFT Christian Plesner Hansen Peter von der Ahé Erik Ernst Mads Torgersen Gilad Bracha June 3, 2003 1 Introduction Notice: This
Java CPD (I) Frans Coenen Department of Computer Science
Java CPD (I) Frans Coenen Department of Computer Science Content Session 1, 12:45-14:30 (First Java Programme, Inheritance, Arithmetic) Session 2, 14:45-16:45 (Input and Programme Constructs) Materials
The Interface Concept
Multiple inheritance Interfaces Four often used Java interfaces Iterator Cloneable Serializable Comparable The Interface Concept OOP: The Interface Concept 1 Multiple Inheritance, Example Person name()
Chapter 1 Java Program Design and Development
presentation slides for JAVA, JAVA, JAVA Object-Oriented Problem Solving Third Edition Ralph Morelli Ralph Walde Trinity College Hartford, CT published by Prentice Hall Java, Java, Java Object Oriented
The C Programming Language course syllabus associate level
TECHNOLOGIES The C Programming Language course syllabus associate level Course description The course fully covers the basics of programming in the C programming language and demonstrates fundamental programming
Arrays in Java. Working with Arrays
Arrays in Java So far we have talked about variables as a storage location for a single value of a particular data type. We can also define a variable in such a way that it can store multiple values. Such
core. Volume I - Fundamentals Seventh Edition Sun Microsystems Press A Prentice Hall Title ULB Darmstadt
core. 2008 AGI-Information Management Consultants May be used for personal purporses only or by libraries associated to dandelon.com network. Volume I - Fundamentals Seventh Edition CAY S. HORSTMANN GARY
How To Write A Program In Java (Programming) On A Microsoft Macbook Or Ipad (For Pc) Or Ipa (For Mac) (For Microsoft) (Programmer) (Or Mac) Or Macbook (For
Projet Java Responsables: Ocan Sankur, Guillaume Scerri (LSV, ENS Cachan) Objectives - Apprendre à programmer en Java - Travailler à plusieurs sur un gros projet qui a plusieurs aspects: graphisme, interface
Cohort: BCA/07B/PT - BCA/06/PT - BCNS/06/FT - BCNS/05/FT - BIS/06/FT - BIS/05/FT - BSE/05/FT - BSE/04/PT-BSE/06/FT
BSc (Hons) in Computer Applications, BSc (Hons) Computer Science with Network Security, BSc (Hons) Business Information Systems & BSc (Hons) Software Engineering Cohort: BCA/07B/PT - BCA/06/PT - BCNS/06/FT
Exception Handling. Overloaded methods Interfaces Inheritance hierarchies Constructors. OOP: Exception Handling 1
Exception Handling Error handling in general Java's exception handling mechanism The catch-or-specify priciple Checked and unchecked exceptions Exceptions impact/usage Overloaded methods Interfaces Inheritance
El Dorado Union High School District Educational Services
El Dorado Union High School District Course of Study Information Page Course Title: ACE Computer Programming II (#495) Rationale: A continuum of courses, including advanced classes in technology is needed.
Preet raj Core Java and Databases CS4PR. Time Allotted: 3 Hours. Final Exam: Total Possible Points 75
Preet raj Core Java and Databases CS4PR Time Allotted: 3 Hours Final Exam: Total Possible Points 75 Q1. What is difference between overloading and overriding? 10 points a) In overloading, there is a relationship
JAVA - QUICK GUIDE. Java SE is freely available from the link Download Java. So you download a version based on your operating system.
http://www.tutorialspoint.com/java/java_quick_guide.htm JAVA - QUICK GUIDE Copyright tutorialspoint.com What is Java? Java is: Object Oriented Platform independent: Simple Secure Architectural- neutral
Basic Object-Oriented Programming in Java
core programming Basic Object-Oriented Programming in Java 1 2001-2003 Marty Hall, Larry Brown http:// Agenda Similarities and differences between Java and C++ Object-oriented nomenclature and conventions
CS 111 Classes I 1. Software Organization View to this point:
CS 111 Classes I 1 Software Organization View to this point: Data Objects and primitive types Primitive types operators (+, /,,*, %). int, float, double, char, boolean Memory location holds the data Objects
Case studies: Outline. Requirement Engineering. Case Study: Automated Banking System. UML and Case Studies ITNP090 - Object Oriented Software Design
I. Automated Banking System Case studies: Outline Requirements Engineering: OO and incremental software development 1. case study: withdraw money a. use cases b. identifying class/object (class diagram)
Basic Programming and PC Skills: Basic Programming and PC Skills:
Texas University Interscholastic League Contest Event: Computer Science The contest challenges high school students to gain an understanding of the significance of computation as well as the details of
CSE 1223: Introduction to Computer Programming in Java Chapter 7 File I/O
CSE 1223: Introduction to Computer Programming in Java Chapter 7 File I/O 1 Sending Output to a (Text) File import java.util.scanner; import java.io.*; public class TextFileOutputDemo1 public static void
Moving from CS 61A Scheme to CS 61B Java
Moving from CS 61A Scheme to CS 61B Java Introduction Java is an object-oriented language. This document describes some of the differences between object-oriented programming in Scheme (which we hope you
Object Oriented Software Design
Object Oriented Software Design Introduction to Java - II Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa September 14, 2011 G. Lipari (Scuola Superiore Sant Anna) Introduction
public static void main(string[] args) { System.out.println("hello, world"); } }
Java in 21 minutes hello world basic data types classes & objects program structure constructors garbage collection I/O exceptions Strings Hello world import java.io.*; public class hello { public static
Syllabus for CS 134 Java Programming
- Java Programming Syllabus Page 1 Syllabus for CS 134 Java Programming Computer Science Course Catalog 2000-2001: This course is an introduction to objectoriented programming using the Java language.
J a v a Quiz (Unit 3, Test 0 Practice)
Computer Science S-111a: Intensive Introduction to Computer Science Using Java Handout #11 Your Name Teaching Fellow J a v a Quiz (Unit 3, Test 0 Practice) Multiple-choice questions are worth 2 points
Specialized Programme on Web Application Development using Open Source Tools
Specialized Programme on Web Application Development using Open Source Tools A. NAME OF INSTITUTE Centre For Development of Advanced Computing B. NAME/TITLE OF THE COURSE C. COURSE DATES WITH DURATION
Project 4 DB A Simple database program
Project 4 DB A Simple database program Due Date April (Friday) Before Starting the Project Read this entire project description before starting Learning Objectives After completing this project you should
MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.
Exam Name MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. 1) The JDK command to compile a class in the file Test.java is A) java Test.java B) java
File class in Java. Scanner reminder. Files 10/19/2012. File Input and Output (Savitch, Chapter 10)
File class in Java File Input and Output (Savitch, Chapter 10) TOPICS File Input Exception Handling File Output Programmers refer to input/output as "I/O". The File class represents files as objects. The
C# and Other Languages
C# and Other Languages Rob Miles Department of Computer Science Why do we have lots of Programming Languages? Different developer audiences Different application areas/target platforms Graphics, AI, List
INTRODUCTION TO COMPUTER PROGRAMMING. Richard Pierse. Class 7: Object-Oriented Programming. Introduction
INTRODUCTION TO COMPUTER PROGRAMMING Richard Pierse Class 7: Object-Oriented Programming Introduction One of the key issues in programming is the reusability of code. Suppose that you have written a program
Stack Allocation. Run-Time Data Structures. Static Structures
Run-Time Data Structures Stack Allocation Static Structures For static structures, a fixed address is used throughout execution. This is the oldest and simplest memory organization. In current compilers,
Lab Experience 17. Programming Language Translation
Lab Experience 17 Programming Language Translation Objectives Gain insight into the translation process for converting one virtual machine to another See the process by which an assembler translates assembly
WRITING DATA TO A BINARY FILE
WRITING DATA TO A BINARY FILE TEXT FILES VS. BINARY FILES Up to now, we have looked at how to write and read characters to and from a text file. Text files are files that contain sequences of characters.
Designing with Exceptions. CSE219, Computer Science III Stony Brook University http://www.cs.stonybrook.edu/~cse219
Designing with Exceptions CSE219, Computer Science III Stony Brook University http://www.cs.stonybrook.edu/~cse219 Testing vs. Debugging Testing Coding Does the code work properly YES NO 2 Debugging Testing
Concepts and terminology in the Simula Programming Language
Concepts and terminology in the Simula Programming Language An introduction for new readers of Simula literature Stein Krogdahl Department of Informatics University of Oslo, Norway April 2010 Introduction
Lecture J - Exceptions
Lecture J - Exceptions Slide 1 of 107. Exceptions in Java Java uses the notion of exception for 3 related (but different) purposes: Errors: an internal Java implementation error was discovered E.g: out
Programming Languages Featherweight Java David Walker
Programming Languages Featherweight Java David Walker Overview Featherweight Java (FJ), a minimal Javalike language. Models inheritance and subtyping. Immutable objects: no mutation of fields. Trivialized
Specialized Programme on Web Application Development using Open Source Tools
Specialized Programme on Web Application Development using Open Source Tools Objective: At the end of the course, Students will be able to: Understand various open source tools(programming tools and databases)
Lecture 9. Semantic Analysis Scoping and Symbol Table
Lecture 9. Semantic Analysis Scoping and Symbol Table Wei Le 2015.10 Outline Semantic analysis Scoping The Role of Symbol Table Implementing a Symbol Table Semantic Analysis Parser builds abstract syntax
1.00 Lecture 1. Course information Course staff (TA, instructor names on syllabus/faq): 2 instructors, 4 TAs, 2 Lab TAs, graders
1.00 Lecture 1 Course Overview Introduction to Java Reading for next time: Big Java: 1.1-1.7 Course information Course staff (TA, instructor names on syllabus/faq): 2 instructors, 4 TAs, 2 Lab TAs, graders
Sample CSE8A midterm Multiple Choice (circle one)
Sample midterm Multiple Choice (circle one) (2 pts) Evaluate the following Boolean expressions and indicate whether short-circuiting happened during evaluation: Assume variables with the following names
Install Java Development Kit (JDK) 1.8 http://www.oracle.com/technetwork/java/javase/downloads/index.html
CS 259: Data Structures with Java Hello World with the IntelliJ IDE Instructor: Joel Castellanos e-mail: joel.unm.edu Web: http://cs.unm.edu/~joel/ Office: Farris Engineering Center 319 8/19/2015 Install
Enumerated Types in Java
Enumerated Types in Java Paul A. Cairns School of Computing Science, Middlesex University, The Burroughs, Hendon, London, NW4 4BT e-mail: [email protected] tel: +44 (0) 181 362 6852 fax: +44 (0) 181 362
Example of a Java program
Example of a Java program class SomeNumbers static int square (int x) return x*x; public static void main (String[] args) int n=20; if (args.length > 0) // change default n = Integer.parseInt(args[0]);
KITES TECHNOLOGY COURSE MODULE (C, C++, DS)
KITES TECHNOLOGY 360 Degree Solution www.kitestechnology.com/academy.php [email protected] [email protected] Contact: - 8961334776 9433759247 9830639522.NET JAVA WEB DESIGN PHP SQL, PL/SQL
Grundlæggende Programmering IT-C, Forår 2001. Written exam in Introductory Programming
Written exam in Introductory Programming IT University of Copenhagen, June 11, 2001 English version All materials are permitted during the exam, except computers. The exam questions must be answered in
CMSC 202H. ArrayList, Multidimensional Arrays
CMSC 202H ArrayList, Multidimensional Arrays What s an Array List ArrayList is a class in the standard Java libraries that can hold any type of object an object that can grow and shrink while your program
Assignment # 2: Design Patterns and GUIs
CSUS COLLEGE OF ENGINEERING AND COMPUTER SCIENCE Department of Computer Science CSc 133 Object-Oriented Computer Graphics Programming Spring 2014 John Clevenger Assignment # 2: Design Patterns and GUIs
Translating to Java. Translation. Input. Many Level Translations. read, get, input, ask, request. Requirements Design Algorithm Java Machine Language
Translation Translating to Java Introduction to Computer Programming The job of a programmer is to translate a problem description into a computer language. You need to be able to convert a problem description
Smallest Java Package? Java.applet.* having 1 class and 3 interfaces. Applet Class and AppletContext, AppletStub, Audioclip interfaces.
OBJECTIVES OF JAVA Objects in java cannot contain other objects; they can only have references to other objects. Deletion of objects will be managed by Run time system. An Object can pass a message to
To Java SE 8, and Beyond (Plan B)
11-12-13 To Java SE 8, and Beyond (Plan B) Francisco Morero Peyrona EMEA Java Community Leader 8 9...2012 2020? Priorities for the Java Platforms Grow Developer Base Grow Adoption
Crash Course in Java
Crash Course in Java Based on notes from D. Hollinger Based in part on notes from J.J. Johns also: Java in a Nutshell Java Network Programming and Distributed Computing Netprog 2002 Java Intro 1 What is
www.sahajsolns.com Chapter 4 OOPS WITH C++ Sahaj Computer Solutions
Chapter 4 OOPS WITH C++ Sahaj Computer Solutions 1 Session Objectives Classes and Objects Class Declaration Class Members Data Constructors Destructors Member Functions Class Member Visibility Private,
Java EE Web Development Course Program
Java EE Web Development Course Program Part I Introduction to Programming 1. Introduction to programming. Compilers, interpreters, virtual machines. Primitive types, variables, basic operators, expressions,
Teach Yourself Java in 21 Minutes
Teach Yourself Java in 21 Minutes Department of Computer Science, Lund Institute of Technology Author: Patrik Persson Contact: [email protected] This is a brief tutorial in Java for you who already know another
CompSci 125 Lecture 08. Chapter 5: Conditional Statements Chapter 4: return Statement
CompSci 125 Lecture 08 Chapter 5: Conditional Statements Chapter 4: return Statement Homework Update HW3 Due 9/20 HW4 Due 9/27 Exam-1 10/2 Programming Assignment Update p1: Traffic Applet due Sept 21 (Submit
CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013
Oct 4, 2013, p 1 Name: CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013 1. (max 18) 4. (max 16) 2. (max 12) 5. (max 12) 3. (max 24) 6. (max 18) Total: (max 100)
Object Oriented Programming with Java. School of Computer Science University of KwaZulu-Natal
Object Oriented Programming with Java School of Computer Science University of KwaZulu-Natal January 30, 2006 2 Object Oriented Programming with Java Notes for the Computer Science Module Object Oriented
Java Coding Style Guide
Java Coding Style Guide Achut Reddy Server Management Tools Group Sun Microsystems, Inc. Created: January 27, 1998 Last modified: May 30, 2000 ABSTRACT The importance and benefits of a consistent coding
Getting Started with the Internet Communications Engine
Getting Started with the Internet Communications Engine David Vriezen April 7, 2014 Contents 1 Introduction 2 2 About Ice 2 2.1 Proxies................................. 2 3 Setting Up ICE 2 4 Slices 2
D06 PROGRAMMING with JAVA
Cicles Formatius de Grau Superior Desenvolupament d Aplicacions Informàtiques D06 PROGRAMMING with JAVA Ch20 Data Structures I PowerPoint presentation, created by Angel A. Juan - ajuanp(@)gmail.com, for
Object-Oriented Programming in Java
Object-Oriented Programming in Java Quiz 1 Jan 10, 2001 Problem 1: Who wants to be a Java developer? (with apologies to Regis) Fill in your answer in the space provided. Question 1: Which is these word-pairs
A TOOL FOR DATA STRUCTURE VISUALIZATION AND USER-DEFINED ALGORITHM ANIMATION
A TOOL FOR DATA STRUCTURE VISUALIZATION AND USER-DEFINED ALGORITHM ANIMATION Tao Chen 1, Tarek Sobh 2 Abstract -- In this paper, a software application that features the visualization of commonly used
Object-Oriented Programming
Object-Oriented Programming Classes Classes are syntactic units used to define objects. They may contain instance variables, which will occur in each instance of the class, instance methods, which can
Semantic Analysis: Types and Type Checking
Semantic Analysis Semantic Analysis: Types and Type Checking CS 471 October 10, 2007 Source code Lexical Analysis tokens Syntactic Analysis AST Semantic Analysis AST Intermediate Code Gen lexical errors
