Java how to program early objects

The full text downloaded to your computer With eBooks you can: search for key concepts, words and phrases make highlights and notes as you study share your notes with friends eBooks are downloaded to your computer and accessible either offline through the Bookshelf (available as a free download), av...

Descripción completa

Detalles Bibliográficos
Otros Autores: Deitel, Paul J., author (author), Deitel, Harvey M., 1945- author
Formato: Libro electrónico
Idioma:Inglés
Publicado: New York, New York : Pearson [2018]
Edición:Eleventh, global edition
Colección:How to program series.
Materias:
Ver en Biblioteca Universitat Ramon Llull:https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009767232006719
Tabla de Contenidos:
  • Cover
  • Half Title
  • Title
  • Copyright Page
  • Contents
  • Foreword 25
  • Preface 27
  • Before You Begin 47
  • 1 Introduction to Computers, the Internet and Java 53
  • 1.1 Introduction 54
  • 1.2 Hardware and Software 56
  • 1.2.1 Moore's Law 56
  • 1.2.2 Computer Organization 57
  • 1.3 Data Hierarchy 59
  • 1.4 Machine Languages, Assembly Languages and High-Level Languages 61
  • 1.5 Introduction to Object Technology 62
  • 1.5.1 Automobile as an Object 63
  • 1.5.2 Methods and Classes 63
  • 1.5.3 Instantiation 63
  • 1.5.4 Reuse 63
  • 1.5.5 Messages and Methopd Calls 64
  • 1.5.6 Attributes and Instance Variables 64
  • 1.5.7 Encapsulation and Information Hiding 64
  • 1.5.8 Inheritance 64
  • 1.5.9 Interfaces 65
  • 1.5.10 Object-Oriented Analysis and Design (OOAD) 65
  • 1.5.11 The UML (Unified Modeling Language) 65
  • 1.6 Operating Systems 66
  • 1.6.1 Windows-A Proprietary Operating System 66
  • 1.6.2 Linux-An Open-Source Operating System 66
  • 1.6.3 Apple's macOS and Apple's iOS for iPhone®, iPad® 67
  • 1.6.4 Google's Android 67
  • 1.7 Programming Languages 68
  • 1.8 Java 70
  • 1.9 A Typical Java Development Environment 71
  • 1.10 Test-Driving a Java Application 74
  • 1.11 Internet and World Wide Web 78
  • 1.11.1 Internet: A Network of Networks 79
  • 1.11.2 World Wide Web: Making the Internet User-Friendly 79
  • 1.11.3 Web Services and Mashups 79
  • 1.11.4 Internet of Things 80
  • 1.12 Software Technologies 81
  • 1.13 Getting Your Questions Answered 83
  • 2 Introduction to Java Applications
  • Input/Output and Operators 87
  • 2.1 Introduction 88
  • 2.2 Your First Program in Java: Printing a Line of Text 88
  • 2.2.1 Compiling the Application 92
  • 2.2.2 Executing the Application 93
  • 2.3 Modifying Your First Java Program 94
  • 2.4 Displaying Text with printf 96
  • 2.5 Another Application: Adding Integers 97
  • 2.5.1 import Declarations 98.
  • 2.5.2 Declaring and Creating a Scanner to Obtain User Input from the Keyboard 98
  • 2.5.3 Prompting the User for Input 99
  • 2.5.4 Declaring a Variable to Store an Integer and Obtaining anInteger from the Keyboard 99
  • 2.5.5 Obtaining a Second Integer 100
  • 2.5.6 Using Variables in a Calculation 100
  • 2.5.7 Displaying the Calculation Result 100
  • 2.5.8 Java API Documentation 101
  • 2.5.9 Declaring and Initializing Variables in Separate Statements 101
  • 2.6 Memory Concepts 101
  • 2.7 Arithmetic 102
  • 2.8 Decision Making: Equality and Relational Operators 106
  • 2.9 Wrap-Up 109
  • 3 Introduction to Classes, Objects, Methods and Strings 120
  • 3.1 Introduction 121
  • 3.2 Instance Variables, set Methods and get Methods 122
  • 3.2.1 Account Class with an Instance Variable, and set and get Methods 122
  • 3.2.2 AccountTest Class That Creates and Uses an Object of Class Account 125
  • 3.2.3 Compiling and Executing an App with Multiple Classes 128
  • 3.2.4 Account UML Class Diagram 128
  • 3.2.5 Additional Notes on Class AccountTest 130
  • 3.2.6 Software Engineering with private Instance Variables and public set and get Methods 130
  • 3.3 Account Class: Initializing Objects with Constructors 131
  • 3.3.1 Declaring an Account Constructor for Custom Object Initialization 132
  • 3.3.2 Class AccountTest: Initializing Account Objects When They're Created 133
  • 3.4 Account Class with a Balance
  • Floating-Point Numbers 134
  • 3.4.1 Account Class with a balance Instance Variable of Type double 135
  • 3.4.2 AccountTest Class to Use Class Account 137
  • 3.5 Primitive Types vs. Reference Types 140
  • 3.6 (Optional) GUI and Graphics Case Study: A Simple GUI 140
  • 3.6.1 What Is a Graphical User Interface? 142
  • 3.6.2 JavaFX Scene Builder and FXML 142
  • 3.6.3 Welcome App-Displaying Text and an Image 142.
  • 3.6.4 Opening Scene Builder and Creating the File Welcome.fxml 142
  • 3.6.5 Adding an Image to the Folder Containing Welcome.fxml 144
  • 3.6.6 Creating a VBox Layout Container 144
  • 3.6.7 Configuring the VBox 144
  • 3.6.8 Adding and Configuring a Label 144
  • 3.6.9 Adding and Configuring an ImageView 146
  • 3.6.10 Previewing the Welcome GUI 147
  • 3.7 Wrap-Up 148
  • 4 Control Statements: Part 1
  • Assignment, ++and
  • Operators 156
  • 4.1 Introduction 157
  • 4.2 Algorithms 157
  • 4.3 Pseudocode 158
  • 4.4 Control Structures 158
  • 4.4.1 Sequence Structure in Java 159
  • 4.4.2 Selection Statements in Java 160
  • 4.4.3 Iteration Statements in Java 160
  • 4.4.4 Summary of Control Statements in Java 160
  • 4.5 if Single-Selection Statement 161
  • 4.6 if...else Double-Selection Statement 162
  • 4.6.1 Nested if...else Statements 163
  • 4.6.2 Dangling-else Problem 164
  • 4.6.3 Blocks 164
  • 4.6.4 Conditional Operator (?:) 165
  • 4.7 Student Class: Nested if...else Statements 165
  • 4.8 while Iteration Statement 168
  • 4.9 Formulating Algorithms: Counter-Controlled Iteration 170
  • 4.10 Formulating Algorithms: Sentinel-Controlled Iteration 174
  • 4.11 Formulating Algorithms: Nested Control Statements 181
  • 4.12 Compound Assignment Operators 185
  • 4.13 Increment and Decrement Operators 186
  • 4.14 Primitive Types 189
  • 4.15 (Optional) GUI and Graphics Case Study: Event Handling
  • Drawing Lines 190
  • 4.15.1 Test-Driving the Completed Draw Lines App 190
  • 4.15.2 Building the App's GUI 191
  • 4.15.3 Preparing to Interact with the GUI Programmatically 195
  • 4.15.4 Class DrawLinesController 197
  • 4.15.5 Class DrawLines-The Main Application Class 199
  • 4.16 Wrap-Up 201
  • 5 Control Statements: Part 2
  • Logical Operators 216
  • 5.1 Introduction 217
  • 5.2 Essentials of Counter-Controlled Iteration 217
  • 5.3 for Iteration Statement 218.
  • 5.4 Examples Using the for Statement 222
  • 5.4.1 Application: Summing the Even Integers from 2 to 20 223
  • 5.4.2 Application: Compound-Interest Calculations 224
  • 5.5 do...while Iteration Statement 227
  • 5.6 switch Multiple-Selection Statement 228
  • 5.7 Class AutoPolicy Case Study: Strings in switch Statements 234
  • 5.8 break and continue Statements 237
  • 5.8.1 break Statement 237
  • 5.8.2 continue Statement 238
  • 5.9 Logical Operators 239
  • 5.9.1 Conditional AND (&amp
  • &amp
  • ) Operator 239
  • 5.9.2 Conditional OR (||) Operator 240
  • 5.9.3 Short-Circuit Evaluation of Complex Conditions 241
  • 5.9.4 Boolean Logical AND (&amp
  • ) and Boolean Logical Inclusive OR (|)Operators 241
  • 5.9.5 Boolean Logical Exclusive OR (^) 242
  • 5.9.6 Logical Negation (!) Operator 242
  • 5.9.7 Logical Operators Example 243
  • 5.10 Structured-Programming Summary 245
  • 5.11 (Optional) GUI and Graphics Case Study: Drawing Rectangles and Ovals 250
  • 5.12 Wrap-Up 253
  • 6 Methods: A Deeper Look 264
  • 6.1 Introduction 265
  • 6.2 Program Units in Java 265
  • 6.3 static Methods, static Fields and Class Math 267
  • 6.4 Methods with Multiple Parameters 269
  • 6.5 Notes on Declaring and Using Methods 273
  • 6.6 Method-Call Stack and Activation Records 274
  • 6.6.1 Method-Call Stack 274
  • 6.6.2 Stack Frames 274
  • 6.6.3 Local Variables and Stack Frames 274
  • 6.6.4 Stack Overflow 275
  • 6.7 Argument Promotion and Casting 275
  • 6.8 Java API Packages 276
  • 6.9 Case Study: Secure Random-Number Generation 278
  • 6.10 Case Study: A Game of Chance
  • Introducing enum Types 283
  • 6.11 Scope of Declarations 288
  • 6.12 Method Overloading 290
  • 6.12.1 Declaring Overloaded Methods 290
  • 6.12.2 Distinguishing Between Overloaded Methods 291
  • 6.12.3 Return Types of Overloaded Methods 292
  • 6.13 (Optional) GUI and Graphics Case Study: Colors and Filled Shapes 292.
  • 6.14 Wrap-Up 295
  • 7 Arrays and ArrayLists 309
  • 7.1 Introduction 310
  • 7.2 Arrays 311
  • 7.3 Declaring and Creating Arrays 312
  • 7.4 Examples Using Arrays 314
  • 7.4.1 Creating and Initializing an Array 314
  • 7.4.2 Using an Array Initializer 315
  • 7.4.3 Calculating the Values to Store in an Array 316
  • 7.4.4 Summing the Elements of an Array 317
  • 7.4.5 Using Bar Charts to Display Array Data Graphically 317
  • 7.4.6 Using the Elements of an Array as Counters 319
  • 7.4.7 Using Arrays to Analyze Survey Results 320
  • 7.5 Exception Handling: Processing the Incorrect Response 322
  • 7.5.1 The try Statement 322
  • 7.5.2 Executing the catch Block 322
  • 7.5.3 toString Method of the Exception Parameter 323
  • 7.6 Case Study: Card Shuffling and Dealing Simulation 323
  • 7.7 Enhanced for Statement 328
  • 7.8 Passing Arrays to Methods 329
  • 7.9 Pass-By-Value vs. Pass-By-Reference 331
  • 7.10 Case Study: Class GradeBook Using an Array to Store Grades 332
  • 7.11 Multidimensional Arrays 337
  • 7.11.1 Arrays of One-Dimensional Arrays 338
  • 7.11.2 Two-Dimensional Arrays with Rows of Different Lengths 338
  • 7.11.3 Creating Two-Dimensional Arrays with Array-Creation Expressions 339
  • 7.11.4 Two-Dimensional Array Example: Displaying Element Values 339
  • 7.11.5 Common Multidimensional-Array Manipulations Performed with for Statements 340
  • 7.12 Case Study: Class GradeBook Using a Two-Dimensional Array 341
  • 7.13 Variable-Length Argument Lists 347
  • 7.14 Using Command-Line Arguments 348
  • 7.15 Class Arrays 350
  • 7.16 Introduction to Collections and Class ArrayList 353
  • 7.17 (Optional) GUI and Graphics Case Study: Drawing Arcs 357
  • 7.18 Wrap-Up 360
  • 8 Classes and Objects: A Deeper Look 381
  • 8.1 Introduction 382
  • 8.2 Time Class Case Study 382
  • 8.3 Controlling Access to Members 387
  • 8.4 Referring to the Current Object's Members with the this Reference 388.