cs2110sp09-01

cs2110sp09-01 - CS 2110 Java overview • very quick...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS 2110 Java overview • very quick overview of Java basics • actually use inheritance and interfaces • intro to threads • Grammars and parsing • GUIs • recursion/induction, efFciency, sorting • data structures (lists, queues, stacks, trees, etc) • graph algorithms • applications • LOTS of programming ! 1 CS 2110 - Spring 2009 Books etc.- at java.sun.com /reference/api /docs/books/tutorial- IDE from www.eclipse.org- The Java Language SpeciFcation (Gosling et al)- Data Structures and Algorithm Analysis in Java (Weiss) ..... - there are many(!!!) books, and most of them are Fne; if you need one then Fnd one that’s not too expensive!! Tuesday, January 20, 2009 CS 2110 Java overview • Java uses classes and objects = hyper organised ! • A class Car is like a manufacturer who only construct s individual new cars. • A class Bucket will only construct individual new buckets. • Cars and buckets have natural things which belong to every car or bucket, although of course cars have different colours, etc.! 2 Tuesday, January 20, 2009 CS 2110 Java overview • To build a red car called ferrari, we might write Car ferrari = new Car(red);- I’m not promising that this will work!!!! and to build a yellow car called ccbb, we might write Car ccbb = new Car(yellow); Of course, Bucket rollsroyce = new Bucket(huge); will only give you a peculiarly named huge bucket. • If you want to access stuff in your car, then the dot is the “genitive case”, so ferrari.colour would be red, and ccbb.colour would be yellow. This is also like a path ; looking into the ferrari or the ccbb to Fnd the individual colours. More on this later ..... . 3 Tuesday, January 20, 2009 CS 2110 Java overview • Enough of such generalities! How do we write a simple program in Java? • First we need to be able to get stuff in to and out from the computer! System.out.println ( “Once upon a time ...” ) ; looks into the System where it ¡nds an out , and looks into System ’s out where it ¡nds a method (or function or routine ) which can print a String of characters onto a fresh line on the standard output screen. System.out.print ( “Golly gosh” ) ; does exactly the same, except the method print doesn’t ¡nish with a “new line”. 4- i /o Tuesday, January 20, 2009 CS 2110 Java overview • To read in a String of characters from the standard input keyboard, InputStreamReader nab = new InputStreamReader(System.in); BufferedReader grab = new BufferedReader(nab); constructs a BufferedReader called grab so that grab.readLine( ); reads a whole line of input. • Java is a language of “let’s pretend!”, so grab is a virtual keyboard which has the ability (amongst other skills) of readLine( ) - all the other stuff is there to establish a connection between “make believe” and “reality”....
View Full Document

This note was uploaded on 02/01/2010 for the course CS 2110 taught by Professor Francis during the Spring '07 term at Cornell.

Page1 / 35

cs2110sp09-01 - CS 2110 Java overview • very quick...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online