Introduction IS 313 4.1.2003. Outline  Goals of the course  Course organization  Java command line  Object-oriented programming  File I/O.

Slides:



Advertisements
Similar presentations
1 Streams and Input/Output Files Part 2. 2 Files and Exceptions When creating files and performing I/O operations on them, the systems generates errors.
Advertisements

Introduction to Java 2 Programming Lecture 7 IO, Files, and URLs.
Lecture 15: I/O and Parsing
Exceptions. Definition Exception: something unexpected that can occur in the execution of a program e.g., divide by zero or attempt to open a file that.
Java File I/O. File I/O is important! Being able to write and read from files is necessary and is also one common practice of a programmer. Examples include.
Chapter 1 Writing a Program Fall Class Overview Course Information –On the web page and Blackboard –
CS 206 Introduction to Computer Science II 01 / 20 / 2009 Instructor: Michael Eckmann.
Lab Information Security Using Java (Review) Lab#0 Omaima Al-Matrafi.
Object Oriented Programming in Java George Mason University Fall 2011
Lab1: File I/O and Streams Lecturer: Mauro Conti T.A.: Eyüp S. Canlar.
Lab#1 (14/3/1431h) Introduction To java programming cs425
George Blank University Lecturer. CS 602 Java and the Web Object Oriented Software Development Using Java Chapter 4.
1 Frameworks. 2 Framework Set of cooperating classes/interfaces –Structure essential mechanisms of a problem domain –Programmer can extend framework classes,
CS 206 Introduction to Computer Science II 01 / 21 / 2009 Instructor: Michael Eckmann.
Chapter 91 Streams and File I/O Chapter 9. 2 Announcements Project 5 due last night Project 6 assigned Exam 2 –Wed., March 21, 7:00 – 8:00 pm, LILY 1105.
March 2004Object Oriented Design1 Object-Oriented Design.
Using Java without BlueJ Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling BlueJ projects A BlueJ.
7/2/2015CS2621 OO Design and Programming II I/O: Reading and Writing.
Lecture 30 Streams and File I/O COMP1681 / SE15 Introduction to Programming.
CS 206 Introduction to Computer Science II 01 / 23 / 2009 Instructor: Michael Eckmann.
Networking with Java CSc 335 Object-Oriented Programming and Design Spring 2009.
Exceptions and IO Dr. Andrew Wallace PhD BEng(hons) EurIng
Web Proxy Server. Proxy Server Introduction Returns status and error messages. Handles http CGI requests. –For more information about CGI please refer.
Streams and File I/O Chapter 14. I/O Overview I/O = Input/Output In this context it is input to and output from programs Input can be from keyboard or.
Platforms for Learning in Computer Science July 28, 2005.
1 CSC 221: Computer Programming I Fall 2004 course overview  what did we set out to learn?  what did you actually learn?  where do you go from here?
CS110/CS119 Introduction to Computing (Java)
Web Security Programming I Building Security in from the Start Except where otherwise noted all portions of this work are Copyright (c) 2007 Google and.
Advanced Java New York University School of Continuing and Professional Studies.
Java Programming Robert Chatley William Lee
CS 240 Week 3. List’Em java Grep [-r] directoryName fileSelectionPattern substringSelectionPattern Run Demo java LineCount [-r] directoryName fileSelectionPattern.
220 FINAL TEST REVIEW SESSION Omar Abdelwahab. INHERITANCE AND POLYMORPHISM Suppose you have a class FunClass with public methods show, tell, and smile.
Two Ways to Store Data in a File Text format Binary format.
1 Chapter 2 First Java Programs Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
Programming in Java Unit 2. Class and variable declaration A class is best thought of as a template from which objects are created. You can create many.
CSCE 2013L: Lab 1 Overview  Java Basics The JVM Anatomy of a Java Program  Object-Oriented Programming Overview  Example: Payroll.java JDK Tools and.
Chapter 9 1 Chapter 9 – Part 1 l Overview of Streams and File I/O l Text File I/O l Binary File I/O l File Objects and File Names Streams and File I/O.
1 Streams Files are a computer’s long term memory Need ability for programs to –get information from files –copy information from program variables to.
Java™ How to Program, 9/e Presented by: Dr. José M. Reyes Álamo © Copyright by Pearson Education, Inc. All Rights Reserved.
MIT AITI 2003 Lecture 15 Streams Input and Output data from/to other sources.
IBM TSpaces Lab 1 Introduction. Summary TSpaces Overview Basic Definitions Basic primitive operations Reading/writing tuples in tuplespace HelloWorld.
CS 206 Introduction to Computer Science II 09 / 10 / 2009 Instructor: Michael Eckmann.
Java Objects and Classes. Overview n Creating objects that belong to the classes in the standard Java library n Creating your own classes.
1 Recitation 8. 2 Outline Goals of this recitation: 1.Learn about loading files 2.Learn about command line arguments 3.Review of Exceptions.
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 23 — Simple Object Access Protocol (SOAP) and Microsoft BizTalk™ Outline 23.1Introduction 23.2Simple.
By Rachel Thompson and Michael Deck.  Java.io- a package for input and output  File I/O  Reads data into and out of the console  Writes and reads.
Parts of JAVA 1www.gowreeswar.com. Features of JAVA 2www.gowreeswar.com.
Lab 2 Primer Assignment 3 Structure File I/O More parsing and HTTP Formatting.
Summing Up Object Oriented Design. Four Major Components: Abstraction modeling real-life entities by essential information only Encapsulation clustering.
Files and Streams CS /02/05 L7: Files Slide 2 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved.
Lecture 5 I/O and Parsing
Fall 2002CS 150: Intro. to Computing1 Streams and File I/O (That is, Input/Output) OR How you read data from files and write data to files.
Introduction to Java Chapter 7 - Classes & Object-oriented Programming1 Chapter 7 Classes and Object-Oriented Programming.
Pengantar OOP Class-Java. 2 Software Development Tools Using Sun Java SDK alone Source File(s) (.java) Programmer Compiler (javac) Class File(s) (.class)
M1G Introduction to Programming 2 5. Completing the program.
Chapter 9 1 Chapter 9 – Part 2 l Overview of Streams and File I/O l Text File I/O l Binary File I/O l File Objects and File Names Streams and File I/O.
Exceptions. Exception  Abnormal event occurring during program execution  Examples Manipulate nonexistent files FileReader in = new FileReader("mumbers.txt“);
Chapter 11: Advanced Inheritance Concepts. Objectives Create and use abstract classes Use dynamic method binding Create arrays of subclass objects Use.
Classes, Interfaces and Packages
Overview Project 2 JFileChooser StringTokenizers Vectors/arrays.
For Friday Finish reading chapter 9 WebCT quiz 17.
Introduction to Java Programming, 4E Y. Daniel Liang.
Geoff Holmes and Bernhard Pfahringer COMP206-08S General Programming 2.
CS202 Java Object Oriented Programming Input and Output Chengyu Sun California State University, Los Angeles.
OO Design and Programming II I/O: Reading and Writing
CSC 221: Computer Programming I Fall 2005
Java Programming Language
18 File i/o, Parsing.
Exceptions.
Exceptions.
Presentation transcript:

Introduction IS

Outline  Goals of the course  Course organization  Java command line  Object-oriented programming  File I/O

Business Application Development  Business process analysis  Systems analysis  Systems integration  Change management  Information systems planning  COTS procurement  Project management  Programming

Goals of course  Increase breadth of Java exposure  Increase depth of programming experience

Breadth  Collections  JDBC  GUI  Threads  Networking  Distributed computing  XML

Characteristics of business applications  Need for adaptability  Part of larger systems  Large and complex

Emphasis  Good program design  Good programming style  Building flexibility and maintainability into the code Vectors of change!

Resources  Office hours CST noon – 3 pm Tuesday  COL web site  Course resource site

Syllabus  Alternating Quizzes Assignments  Pre-test “homework #0”  Final 6/11

Grading rubric  Knowledge Program shows that you know the important Java concepts  Reasoning Program shows good design decisions  Communication Program is readable

Homework #0  Pre-test  Simple Java class  Main method that tests it  New? jar

Java command line  Running DOS command shell  Navigating to the location of your files  Running JDK programs

JDK programs  javac java compiler.java ->.class  java java virtual machine class name  jar java archive

jar  Create an archive jar cvf jar-file files

Issues  “current” directory in DOS shell  classpath -classpath for javac -cp for java  wildcards multiple files

Object-oriented programming  Class template for an object associates data structure with data manipulation  Object instance of a class  Methods “program” part of the object  Constructor special method called at creation time

Method signature  Consists of method name parameter types return type  Example public Baz toBaz (Bar b, Foo f)  Signature Baz toBaz (Bar, Foo)

Inheritance  Class is a subclass of another class All (non-private) methods and instance variables from superclass belong to subclass programmer gets computational power for “free”  Overriding Supply subclass method with same signature as superclass method

Interfaces  Collection of method signatures no implementation  Use establish how objects will interact  without specifying what they do A class “implements” an interface  Interfaces can inherit from others

Why use interfaces?  Single inheritance but multiple interfaces  Efficiency inheritance is expensive  “Loose coupling”

Example  class C1 implements I1  class C2 extends C1 implements I2  Which are legal? C1 o1; o1 = new I1 (); o1 = new C1 (); o1 = new I2 (); o1 = new C2 (); I1 o2; o2 = new C1 (); o2 = new C2 (); C2 o3; o3 = new C1 (); o3 = new C2 (); I2 o4; o4 = new C1 (); o4 = new C2 ();

Input and Output  Sources files network strings keyboard  Streams input output

Text input  Reading from the keyboard String s = new BufferedReader ( new InputStreamReader(System.in)).readLine();  Reading from a file String s = new BufferedReader ( new FileReader(“data.txt”)).readLine();

Text output  Writer  Output to file BufferedWriter w = new BufferedWriter ( new FileWriter (“output.txt”)); w.println (“foo”);

Actual example public void load (String filename) { BufferedReader in = null; try { in = new BufferedReader (new FileReader (filename)); } catch (IOException e) { System.err.println ("Error opening file: " + filename + " Exiting."); System.exit(-2); } String line; try { while ((line = in.readLine()) != null) { try {... do something with the line...; } catch (java.text.ParseException e) { System.err.println("Couldn't parse date: " + line); } } catch (IOException e) { System.err.println ("Error reading file " + filename + "."); }

StringTokenizer  Takes a string apart String text = “Whatever you want, you’ll get it.”; StringTokenizer st = new StringTokenizer (text); while (st.hasMoreTokens()) { String word = st.nextToken ();... process token... }