![Page 1: Introduction IS 313 4.1.2003. Outline Goals of the course Course organization Java command line Object-oriented programming File I/O](https://reader035.vdocument.in/reader035/viewer/2022062518/56649f1b5503460f94c308b0/html5/thumbnails/1.jpg)
Introduction
IS 3134.1.2003
![Page 2: Introduction IS 313 4.1.2003. Outline Goals of the course Course organization Java command line Object-oriented programming File I/O](https://reader035.vdocument.in/reader035/viewer/2022062518/56649f1b5503460f94c308b0/html5/thumbnails/2.jpg)
Outline Goals of the course Course organization Java command line Object-oriented programming File I/O
![Page 3: Introduction IS 313 4.1.2003. Outline Goals of the course Course organization Java command line Object-oriented programming File I/O](https://reader035.vdocument.in/reader035/viewer/2022062518/56649f1b5503460f94c308b0/html5/thumbnails/3.jpg)
Business Application Development Business process analysis Systems analysis Systems integration Change management Information systems planning COTS procurement Project management Programming
![Page 4: Introduction IS 313 4.1.2003. Outline Goals of the course Course organization Java command line Object-oriented programming File I/O](https://reader035.vdocument.in/reader035/viewer/2022062518/56649f1b5503460f94c308b0/html5/thumbnails/4.jpg)
Goals of course Increase breadth of Java exposure Increase depth of programming
experience
![Page 5: Introduction IS 313 4.1.2003. Outline Goals of the course Course organization Java command line Object-oriented programming File I/O](https://reader035.vdocument.in/reader035/viewer/2022062518/56649f1b5503460f94c308b0/html5/thumbnails/5.jpg)
Breadth Collections JDBC GUI Threads Networking Distributed computing XML
![Page 6: Introduction IS 313 4.1.2003. Outline Goals of the course Course organization Java command line Object-oriented programming File I/O](https://reader035.vdocument.in/reader035/viewer/2022062518/56649f1b5503460f94c308b0/html5/thumbnails/6.jpg)
Characteristics of business applications Need for adaptability Part of larger systems Large and complex
![Page 7: Introduction IS 313 4.1.2003. Outline Goals of the course Course organization Java command line Object-oriented programming File I/O](https://reader035.vdocument.in/reader035/viewer/2022062518/56649f1b5503460f94c308b0/html5/thumbnails/7.jpg)
Emphasis Good program design Good programming style Building flexibility and maintainability into
the code Vectors of change!
![Page 8: Introduction IS 313 4.1.2003. Outline Goals of the course Course organization Java command line Object-oriented programming File I/O](https://reader035.vdocument.in/reader035/viewer/2022062518/56649f1b5503460f94c308b0/html5/thumbnails/8.jpg)
Resources Office hours
CST 453 12 noon – 3 pm Tuesday
COL web site http://dlweb.cti.depaul.edu/
Course resource site http://josquin.cti.depaul.edu/~rburke/s03/is313/
![Page 9: Introduction IS 313 4.1.2003. Outline Goals of the course Course organization Java command line Object-oriented programming File I/O](https://reader035.vdocument.in/reader035/viewer/2022062518/56649f1b5503460f94c308b0/html5/thumbnails/9.jpg)
Syllabus Alternating
Quizzes Assignments
Pre-test “homework #0”
Final 6/11
![Page 10: Introduction IS 313 4.1.2003. Outline Goals of the course Course organization Java command line Object-oriented programming File I/O](https://reader035.vdocument.in/reader035/viewer/2022062518/56649f1b5503460f94c308b0/html5/thumbnails/10.jpg)
Grading rubric Knowledge
Program shows that you know the important Java concepts
Reasoning Program shows good design decisions
Communication Program is readable
![Page 11: Introduction IS 313 4.1.2003. Outline Goals of the course Course organization Java command line Object-oriented programming File I/O](https://reader035.vdocument.in/reader035/viewer/2022062518/56649f1b5503460f94c308b0/html5/thumbnails/11.jpg)
Homework #0 Pre-test Simple Java class Main method that tests it New?
jar
![Page 12: Introduction IS 313 4.1.2003. Outline Goals of the course Course organization Java command line Object-oriented programming File I/O](https://reader035.vdocument.in/reader035/viewer/2022062518/56649f1b5503460f94c308b0/html5/thumbnails/12.jpg)
Java command line Running DOS command shell Navigating to the location of your files Running JDK programs
![Page 13: Introduction IS 313 4.1.2003. Outline Goals of the course Course organization Java command line Object-oriented programming File I/O](https://reader035.vdocument.in/reader035/viewer/2022062518/56649f1b5503460f94c308b0/html5/thumbnails/13.jpg)
JDK programs javac
java compiler .java -> .class
java java virtual machine class name
jar java archive
![Page 14: Introduction IS 313 4.1.2003. Outline Goals of the course Course organization Java command line Object-oriented programming File I/O](https://reader035.vdocument.in/reader035/viewer/2022062518/56649f1b5503460f94c308b0/html5/thumbnails/14.jpg)
jar Create an archive
jar cvf jar-file files
![Page 15: Introduction IS 313 4.1.2003. Outline Goals of the course Course organization Java command line Object-oriented programming File I/O](https://reader035.vdocument.in/reader035/viewer/2022062518/56649f1b5503460f94c308b0/html5/thumbnails/15.jpg)
Issues “current” directory
in DOS shell classpath
-classpath for javac -cp for java
wildcards multiple files
![Page 16: Introduction IS 313 4.1.2003. Outline Goals of the course Course organization Java command line Object-oriented programming File I/O](https://reader035.vdocument.in/reader035/viewer/2022062518/56649f1b5503460f94c308b0/html5/thumbnails/16.jpg)
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
![Page 17: Introduction IS 313 4.1.2003. Outline Goals of the course Course organization Java command line Object-oriented programming File I/O](https://reader035.vdocument.in/reader035/viewer/2022062518/56649f1b5503460f94c308b0/html5/thumbnails/17.jpg)
Method signature Consists of
method name parameter types return type
Example public Baz toBaz (Bar b, Foo f)
Signature Baz toBaz (Bar, Foo)
![Page 18: Introduction IS 313 4.1.2003. Outline Goals of the course Course organization Java command line Object-oriented programming File I/O](https://reader035.vdocument.in/reader035/viewer/2022062518/56649f1b5503460f94c308b0/html5/thumbnails/18.jpg)
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
![Page 19: Introduction IS 313 4.1.2003. Outline Goals of the course Course organization Java command line Object-oriented programming File I/O](https://reader035.vdocument.in/reader035/viewer/2022062518/56649f1b5503460f94c308b0/html5/thumbnails/19.jpg)
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
![Page 20: Introduction IS 313 4.1.2003. Outline Goals of the course Course organization Java command line Object-oriented programming File I/O](https://reader035.vdocument.in/reader035/viewer/2022062518/56649f1b5503460f94c308b0/html5/thumbnails/20.jpg)
Why use interfaces? Single inheritance
but multiple interfaces Efficiency
inheritance is expensive “Loose coupling”
![Page 21: Introduction IS 313 4.1.2003. Outline Goals of the course Course organization Java command line Object-oriented programming File I/O](https://reader035.vdocument.in/reader035/viewer/2022062518/56649f1b5503460f94c308b0/html5/thumbnails/21.jpg)
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 ();
![Page 22: Introduction IS 313 4.1.2003. Outline Goals of the course Course organization Java command line Object-oriented programming File I/O](https://reader035.vdocument.in/reader035/viewer/2022062518/56649f1b5503460f94c308b0/html5/thumbnails/22.jpg)
Input and Output Sources
files network strings keyboard
Streams input output
![Page 23: Introduction IS 313 4.1.2003. Outline Goals of the course Course organization Java command line Object-oriented programming File I/O](https://reader035.vdocument.in/reader035/viewer/2022062518/56649f1b5503460f94c308b0/html5/thumbnails/23.jpg)
Text input Reading from the keyboard
String s = new BufferedReader (new InputStreamReader(System.in)).readLine();
Reading from a fileString s = new BufferedReader (
new FileReader(“data.txt”)).readLine();
![Page 24: Introduction IS 313 4.1.2003. Outline Goals of the course Course organization Java command line Object-oriented programming File I/O](https://reader035.vdocument.in/reader035/viewer/2022062518/56649f1b5503460f94c308b0/html5/thumbnails/24.jpg)
Text output Writer Output to file
BufferedWriter w = new BufferedWriter (
new FileWriter (“output.txt”));
w.println (“foo”);
![Page 25: Introduction IS 313 4.1.2003. Outline Goals of the course Course organization Java command line Object-oriented programming File I/O](https://reader035.vdocument.in/reader035/viewer/2022062518/56649f1b5503460f94c308b0/html5/thumbnails/25.jpg)
Actual examplepublic 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 + "."); }}
![Page 26: Introduction IS 313 4.1.2003. Outline Goals of the course Course organization Java command line Object-oriented programming File I/O](https://reader035.vdocument.in/reader035/viewer/2022062518/56649f1b5503460f94c308b0/html5/thumbnails/26.jpg)
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 ...
}