[Skip to Body]
Primary:
[Front Door]
[Current]
[Glance]
-
[Honesty]
[Links]
[Syllabus]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Readings]
[Reference]
Misc:
[SamR]
[Java 1.4.2 API]
[EIJ]
[CS152 2000F]
[CS153 2004S]
Back to An Introduction to Java (1). On to Object Basics.
Held: Wednesday, 1 September 2004
Summary: Today we continue our initial investigations into the Java programming language, focusing primarily on input and output.
Related Pages:
Notes:
Overview:
cd CS152
mkdir some-name-for-todays-class
(for today, mkdir class04
)
cd some-name-for-todays-class
(for today, mkdir class04
)
kate
, which starts the Kate editor. (Warning! For some reason, on our current system, Kate spews a ton of error messages. Ignore them.)
Second.java
) in Kate as specified above.
introjava
with class04
.
jc Second.java
ji class04.Second
to confirm that it runs.
ji introjava.Second
. Why haven't you seen changes?
ji class04.Second
.
PrintWriter
(or, more precisely, a java.io.PrintWriter
) in order to write output, so must we create a particular object to read input.
// Set up input using keyboard. BufferedReader keyboard = new BufferedReader(new InputStreamReader(System.in));
import java.io.InputStreamReader; import java.io.BufferedReader;
readLine()
method and store it in a string.
String color = keyboard.readLine();
BufferedReader
objects can only read strings.
Integer.parseInt(String s)
method to convert strings to integers.
Back to An Introduction to Java (1). On to Object Basics.
[Skip to Body]
Primary:
[Front Door]
[Current]
[Glance]
-
[Honesty]
[Links]
[Syllabus]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Readings]
[Reference]
Misc:
[SamR]
[Java 1.4.2 API]
[EIJ]
[CS152 2000F]
[CS153 2004S]
Disclaimer:
I usually create these pages on the fly
, which means that I rarely
proofread them and they may contain bad grammar and incorrect details.
It also means that I tend to update them regularly (see the history for
more details). Feel free to contact me with any suggestions for changes.
This document was generated by
Siteweaver on Wed Dec 8 10:37:06 2004.
The source to the document was last modified on Thu Aug 26 20:22:22 2004.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS152/2004F/Outlines/outline.04.html
.
You may wish to
validate this document's HTML
;
;
Check with Bobby