Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword or section
Like this
3Activity

Table Of Contents

0 of .
Results for:
No results containing your search query
P. 1
javanotes5_part1

javanotes5_part1

Ratings: (0)|Views: 138 |Likes:
Published by api-3836341
Java books
Java books

More info:

Published by: api-3836341 on Oct 18, 2008
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

05/09/2014

pdf

text

original

Introduction to Programming Using Java
Version 5.0
Part I, August 2006
David J. Eck
Hobart and William Smith Colleges
ii
c
\ue0002006, David J. Eck
This book can be distributed in unmodi\ufb01ed form with no restrictions.
Modi\ufb01ed versions can be made and distributed provided they are
distributed under the same license as the original. More speci\ufb01cally:
This work is licensed under the Creative Commons Attribution-
Share Alike 2.5 License. To view a copy of this license, visit

http://creativecommons.org/licenses/by-sa/2.5/ or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.

David J. Eck (eck@hws.edu)
Department of Mathematics and Computer Science
Hobart and William Smith Colleges

Geneva, NY 14456
Contents
Preface
v
1 The Mental Landscape
1

1.1 Machine Language. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.2 AsynchronousEvents. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.3 The Java Virtual Machine. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 1.4 Building Blocks of Programs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.5 Object-oriented Programming. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 1.6 The Modern User Interface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 1.7 TheInternet. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 Quiz on Chapter 1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

2 Names and Things
19
2.1 The Basic Java Application. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.2 Variables and Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
2.2.1 Variables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

2.2.2 Types and Literals. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
2.2.3 Variables in Programs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
2.3 Objects and Subroutines. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
2.3.1 Built-in Subroutines and Functions. . . . . . . . . . . . . . . . . . . . . . 29
2.3.2 Operations on Strings. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
2.3.3 Introduction to Enums. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
2.4 Text Input and Output. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
2.4.1 A First Text Input Example. . . . . . . . . . . . . . . . . . . . . . . . . . 37

2.4.2 TextOutput. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 2.4.3 TextIO Input Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 2.4.4 FormattedOutput. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 2.4.5 Introduction to File I/O. . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

2.5 Details of Expressions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 2.5.1 ArithmeticOperators. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 2.5.2 Increment and Decrement. . . . . . . . . . . . . . . . . . . . . . . . . . . 46 2.5.3 RelationalOperators. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 2.5.4 BooleanOperators. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 2.5.5 ConditionalOperator. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 2.5.6 Assignment Operators and Type-Casts. . . . . . . . . . . . . . . . . . . . 48 2.5.7 Type Conversion of Strings. . . . . . . . . . . . . . . . . . . . . . . . . . 50 2.5.8 PrecedenceRules. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

2.6 ProgrammingEnvironments. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
iii

Activity (3)

You've already reviewed this. Edit your review.
1 thousand reads
1 hundred reads

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->