Chapter 3: Fundamental Programming Structures in Java .......................
42
A Simple Java Program .............................................................................
3.1
46
Comments ...................................................................................................
3.2
47
Data Types ...................................................................................................
3.3
47
Integer Types ................................................................................
3.3.1
48
Floating-Point Types ...................................................................
3.3.2
50
The
char
Type ................................................................................
3.3.3
51
Unicode and the
char
Type ..........................................................
3.3.4
52
The
boolean
Type ............................................................................
3.3.5
53
Variables ......................................................................................................
3.4
54
Initializing Variables ...................................................................
3.4.1
55
Constants ......................................................................................
3.4.2
56
Operators ....................................................................................................
3.5
57
Mathematical Functions and Constants ...................................
3.5.1
59
Conversions between Numeric Types ......................................
3.5.2
60
Casts ..............................................................................................
3.5.3
61
Combining Assignment with Operators ..................................
3.5.4
61
Increment and Decrement Operators .......................................
3.5.5
62
Relational and
boolean
Operators ................................................
3.5.6
63
Bitwise Operators ........................................................................
3.5.7
64
Parentheses and Operator Hierarchy .......................................
3.5.8
65
Enumerated Types ......................................................................
3.5.9
65
Strings ..........................................................................................................
3.6
66
Substrings .....................................................................................
3.6.1
66
Concatenation ..............................................................................
3.6.2
67
Strings Are Immutable ................................................................
3.6.3
68
Testing Strings for Equality ........................................................
3.6.4
69
Empty and Null Strings ..............................................................
3.6.5
70
Code Points and Code Units ......................................................
3.6.6
71
The
String
API ................................................................................
3.6.7
74
Reading the Online API Documentation .................................
3.6.8
77
Building Strings ...........................................................................
3.6.9
78
Input and Output .......................................................................................
3.7
79
Reading Input ..............................................................................
3.7.1
82
Formatting Output ......................................................................
3.7.2
Contents
vi
From the Library of Hristo Dimov Hristov
ptg18360597
87
File Input and Output .................................................................
3.7.3
89
Control Flow ...............................................................................................
3.8
89
Block Scope ...................................................................................
3.8.1
90
Conditional Statements ..............................................................
3.8.2
94
Loops .............................................................................................
3.8.3
99
Determinate Loops ......................................................................
3.8.4
103
Multiple Selections—The
switch
Statement .............................
3.8.5
106
Statements That Break Control Flow ......................................
3.8.6
108
Big Numbers .............................................................................................
3.9
111
Arrays ........................................................................................................
3.10
113
The “for each” Loop ..................................................................
3.10.1
114
Array Initializers and Anonymous Arrays ............................
3.10.2
114
Array Copying ...........................................................................
3.10.3
116
Command-Line Parameters .....................................................
3.10.4
117
Array Sorting .............................................................................
3.10.5
120
Multidimensional Arrays .........................................................
3.10.6
124
Ragged Arrays ...........................................................................
3.10.7
Do'stlaringiz bilan baham: |