词条 | Java语言:计算机科学与程序设计(第3版) |
释义 | 版权信息作者:萨维特 (Walter Savitch) 出版社: 清华大学出版社; 第1版 (2004年4月1日) 外文书名: Java: An Introduction to Computer Science and Programming, Third Edition 丛书名: 大学计算机教育国外著名教材系列(影印版) 平装: 942页正文语种: 简体中文, 英语 开本: 16 ISBN: 9787302083030 条形码: 9787302083030 商品尺寸: 22.6 x 18.6 x 4.6 cm 商品重量: 1.4 Kg ASIN: B001EHEYI2 内容简介《Java语言:计算机科学与程序设计》是由著名作者Walter Savitch编写的,主要介绍了Java 程序设计,对Java语言的主要特点和应用编程进行了全面讲述。《Java语言:计算机科学与程序设计》最显著的特点是,作者采用通俗易懂的方式,结合Java语方,介绍了各种基本编程技术,阐述了面向对象编程技术与计算机科学的各种概念。《Java语言:计算机科学与程序设计》每章后附本章小结,并提供了测试题和答案、编程项止练习,以帮助学生对所学知识的掌握,提高学生的实际编程能力。《Java语言:计算机科学与程序设计》配套光盘包含了范例程序代码和相应软件。 《Java语言:计算机科学与程序设计》可作为计算机科学及相关专业的Java程序设计教材,也是Java开发人员的很好参考书。 编辑推荐《Java语言:计算机科学与程序设计(第3版)》是由清华大学出版社出版的。 作者简介作者:(美国)萨维特 (Walter Savitch) 目录CHAPTER 1 Introduction to Computers and Java Objectives Prerequisites 1.1 Computer Basics Hardware and Memory Programs Programming Languages and Compilers Java Byte-Code Linking 1.2 Designing Programs Object-Oriented Programming Encapsulation Polymorphism Inheritance If You Know Some Other Programming Language Ngorithms Reusable Components Testing and Debugging 6otcha: Coping with "Gotchas" 6otcha: Hidden Errors 1.3 A Sip of Java History of the Java Language Applets A First Java Application Program Compiling a Java Program or Class Running a Java Program Preview Examples of Applets (Optional) Chapter Summary Answers to Self-Test Questions Programming Projects CHAPTER 2 Primitive Types, Strings, and Console I/O Objectives Prerequisites 2.1 Primitive Types and Expressions Variables Java Identifiers 6otcha: Java Is Case-Sensitive Primitive Types Assignment Statements Specialized Assignment Operators Simple Input and Output Number Constants Assignment Compatibilities Type Casting Java Tip: Type Casting a Character to an Integer Programming Tip: Initialize Variables Gotcha: Imprecision in Floating-Point Numbers Arithmetic Operators Parentheses and Precedence Rules Case Study: Vending Machine Change Increment and Decrement Operators More about the Increment and Decrement Operators 2.2 The Class String String Constants and Variables Concatenation of Strings Classes String Methods String Processing Escape Characters The Unicode Character Set 2.3 Keyboard and Screen I/O Screen Output Input Using SavitchIn More Input Methods Gotcha: readInt and readDoub3 e Programming Tip: Echo Input 2.4 Documentation and Style Programming Tip: Use Meaningful Names for Variables Documentation and Comments Indenting Named Constants Chapter Summary Answers to Self-Test Questions Programming Projects CHAPTER 3 Flow of Control Objectives Prerequisites 3.1 Branching Statements The if-else Statement Introduction to Boolean Expressions Gotcha: Using==with Strings Programming Tip: Alphabetical Order Nested Statements and Compound Statements Java Tip: Matching else and if Multibranch if-el se Statements Programming Example: Assigning Letter Grades The switch Statement Gotcha: Omitting a break Statement The Conditional Operator (Optional) 3.2 Java Loop Statements while Statements Java Tip: A while Loop Can Perform Zero Iterations The do-while Statement Programming Example: Bug Infestation Gotcha: Infinite Loops The for Statement the Camma in for Statements (Optional) Gotcha: Extra Semicolon in a Loop Statement Java Tip: Choosing a Loop Statement The break Statement in Loops Gotcha: Misuse of break Statements The exit Method 3.3 Programming with Loops The Loop Body Initializing Statements Ending a Loop Programming Example: Nested Loops Programming Tip: Avoid Declaring Variables in a Loop Body Loop Bugs Tracing Variables 3.4 The Type boolean Boolean Expressions and Boolean Variables Programming Tip: Naming Boolean Variables Precedence Rules Input and Output of Boolean Values Case Study: Using a Boolean Variable to End a Loop Chapter Summary Answers to Self-Test Questions Programming Projects CHAPTER 4 Defining Classes and Methods Objectives Prerequisites 4.1 Class and Method Definitions Class Files and Separate Compilation Instance Variables Using Methods void Method Definitions Methods That Return a Value Java Tip: Use of return in void Methods The this Parameter Local Variables Blocks Gotcha:Variables Declared in a Block Java Tip: Declaring Variables in a for Statement Parameters of a Primitive Type Gotcha: Use of the Terms Parameter and Argument Summary of Class and Method Definition Syntax 4.2 Information Hiding and Encapsulation Information Hiding Programming Tip: Parameter Names Are Local to the Method Precondition and Postcondition Comments Java Tip: Assertion Checks The publ i c and private Modifiers Programming Tip: Instance Variables Should Be private Programming Example: A Purchase Class Encapsulation Automatic Documentation with javadoc UML Class Diagrams 4.3 Objects and Reference Variables of a Class Type and Objects Gotcha: Use of = and == with Variables of a Class Type Java Tip: Define an equal s Method for Your Classes Programming Example: A Species Class Boolean-Valued Methods Class Parameters Comparing Class Parameters and Primitive-Type Parameters Chapter Summary Answers to Self-Test Questions Programming Projects CHAPTER 5 More About Objects and Methods Objectives Prerequisites 5.1 Programming with Methods Methods Calling Methods Programming Tip: Make Helping Methods Private Java Tip: Make the compiler Happy Gotcha: Null Pointer Exception 5.2 Static Methods and Static Variables Static Methods Gotcha: Invoking a Nonstatic Method Within a Static Method Java Tip: You Can Put a main in Any Class Static Variables (Optional) The Math Class Integer, Double, and Other Wrapper Classes 5.3 Designing Methods Case Study: Formatting Output Top-Down Design Testing Methods 5.4 Overloading Overloading Basics Programming Example: A Pet Class Gotcha: Overloading and Automatic Type Conversion Gotcha: You Cannot Overload on the Basis of the Returned Type Programming Example: A Class for Money 5.5 Constructors Defining Constructors Programming Tip: You Can Use Other Methods in a Constructor Gotcha: Omitting the Default Constructor Gotcha: Many Wrapper Classes Have No Default Constructor 5.6 Information Hiding Revisited Gotcha: Privacy Leaks 5.7 Packages Packages and importing Package Names and Directodes Gotcha: Not Including the Current Directory in Your Class Path Name Clashes Chapter Summary Answers to Self-Test Questions Programming Projects CHAPTER 6 Arrays Objectives Prerequisites 6.1 Array Basics Creating and Accessing Arrays Array Details Programming Tip: Use Singular Array Names The length Instance Variable Java Tip: Array Indices Start with Zero Programming Tip: Use a for Loop to Step Through an Array Gotcha: Array Index Out of Bounds Initializing Arrays 6.2 Arrays in Classes and Methods Case Study: Sales Report Indexed Vadablas as Method Arguments Entire Arrays as Method Arguments Arguments for the Method mai n Gotcha: Use of = and == with Arrays Methods That Return Arrays 6.3 Progrannning with Arrays and Classes Programming Example: A Specialized List Class Partially Filled Arrays Searching an Array Gotcha: Returning an Array Instance Variable 6.4 Sorting Arrays Selection Sort Other Sorting Algorithms 6.5 Multidimensional Arrays Multidimensional-Array Basics Multidimensional-Array Parameters and Returned Values Implementation of Multidimensional Arrays Bagged Arrays (OpUonal) Programming Example: Employee Time Records Chapter Summary Answers to Self-Test Questions Programming Projects CHAPTER 7 Inheritance Objectives Prerequisites 7.1 Inheritance Basics Programming Example: A Person Class Derived Classes Overriding Method Definitions Overriding Versus Overloading The final Modifier Gotcha: Use of Private Instance Variables from the Base Class Programming Tip: Assume That Your Coworkers Are Malicious Gotcha: Private Methods Are Not Inherited UML Inheritance Diagrams 7.2 Programming with Inheritance Constructors in Derived Classes The this Method (OpUonal) Call to an Overridden Method Programming Example: Multilevel Derived Classes A Subtle Point About Overloading and Overriding (Optional) Java Tip: You Cannot Use Multiple supers Programming Tip: An Object Can Have More than One Type Programming Tip: "Is a" and "Has a" Relations The Class Object Case Study: Character Graphics Abstract Classes Interlaces (Optional) 7.3 Dynamic Binding and Polymorphism Dynamic Binding Type Checking and Dynamic Binding Dynamic Binding with toString Polymorphism Java Tip: A Better equal s Method (Optional) Chapter Summary Answers to Self-Test Questions Programming Projects CHAPTER 8 Exception Handling Objectives Prerequisites 8.1 Basic Exception Handling Exceptions in Java Predefined Exception Classes ArrayIndexOutOfBoundsException (Alternative Ordering) 8.2 Defining Exception Classes Defining Your Own Exception Classes Java Tip: Preserve getMessage When You Define Exception Classes Programming Tip: When to Define an Exception Class 8.3 Using Exception Classes Declaring Exceptions (Passing the Buck) Exceptions That De Not Need To Be Caught The Assertion Error Class (Optional) Multiple Throws and Catches Java Tip: Catch the More Specific Exception First Programming Tip: Exception Handling and Information Hiding Gotcha: Overuse of Exceptions Programming Tip: When to Throw an Exception Gotcha: Nested try-catch Blocks The finally Block (Optional) Rethrowing an Exception (Optional) Case Study' A Line-Oriented Calculator Chapter Summary Answers to Self-Test Questions Programming Projects CHAPTER 9 Streams and File I/O Objectives Prerequisites 9.1 An Overview of Streams and File I/O The Concept of a Stream Why Use Files for I/O? Differences between Text Files and Binary Files 9.2 Text-File I/O Text-File Output with PrintWriter Gotcha: A try Block Is a Block Gotcha: Overwriting a File Java Tip: Appending To a Text File Java Tip: Use toString for Text-File Output Text-File Input with BufferedReader Programming Example: Reading a File Name from the Keyboard Java Tip: Using Path Names The StringTokeni zer Class Java Tip: Testing for the End of a Text File The Classes FileReader and FileOutputStream Unwrapping the Class Savi tchIn 9.3 The File Class Using the File Class 9.4 Basic Binary-File I/O Output to Binary Files, Using ObjectOutputStream Some Details about writeUTF (Optional) Reading Input from a Binary File, Using ObjectInputStream Gotcha: Using ObjectInputStream with a Text File Gotcha: Defining a Method to Open a Stream The EOFExcepti on Class Gotcha: Forgetting to Check for the End of a File Gotcha: Checking for the End of a File in the Wrong Way The Classes Fi I eInputSt ream and File0utputStream Programming Example: Processing a File of Binary Data 9.5 Object I/O with Object Streams Binary I/0 of Class Objects Gotcha: Exceptions, Exceptions, Exceptions The Serializable Interface Gotcha: Mixing Class Types in the Same File Array Objects in Binary Files Chapter Summary Answers to Self-Test Questions Programming Projects CHAPTER 10 Dynamic Data Structures Objectives Prerequisites 10.1 Vectors Using Vectors Programming Tip: Adding to a Vector Gotcha: Vector Elements Are of Type Object Comparing Vectors and Arrays Gotcha: Using capacity Instead of size Java Tip: Use trimToSize to Save Memory Gotcha: Using the Method clone Java Tip: Newer Collection Classes (Optional) 10.2 Linked Data Structures Linked Lists Gotcha: Null Pointer Exception Gotcha: Privacy Leaks Inner Classes Node Inner Classes Iterators Programming Tip: Internal and External Iterators Exception Handling with Linked Lists Variations on a Linked List Other Linked Data Structures Chapter Summary Answers to Self-Test Questions Programming Projects CHAPTER 11 Recursion Objectives Prerequisites 11.1 The Basics of Recursion Case Study: Digits to Words How Recursion Works Gotcha: Infinite Recursion Recursive versus Iterative DefinItions Recursive Methods That Return a Value 11.2 Programming with Recursion Programming Tip: Ask Until the User Gets It Right Case Study: Binary Search Programming Tip: Generalize the Problem Programming Example: Merge Sort——A Recursive Sorting Method Chapter Summary Answers to Self-Test Questions Programming Projects CHAPTER 12 Window Interfaces Using Swing Objectives Prerequisites 12.1 Background GUIs——-Graphical User Interfaces Event-Driven Programming 12.2 Basic Swing Details Gotcha: Save All Your Work before Running a Swing Program Programming Example: A Simple Window Java Tip: Ending a Swing Program Gotcha: Forgetting to Program the Close-Window Button Gotcha: Forgetting to Use getContentPane More about Window Listeners Size Units for Screen Objects More on setVisible Programming Example: A Better Version of Our First Swing Program Programming Example: A Window with Color Some Methods of the Class JFrame Layout Managers 12.3 Buttons and Action Listeners Programming Example: Adding Buttons Buttons Action Listeners and Action Events Gotcha: Changing the Parameter List for actionPerformed Interfaces Java Tip: Code a GUI's Look and Actions Separately The Model-View——Controller Pattern Java Tip: Use the Method setActionCommand 12.4 Container Classes The JPanel Class The Eontainer Class Java Tip: Guide for Creating Simple Window Interfaces 12.5 Text I/O for GUIs Text Areas and Text Fields Programming Example: Labeling a Text Field Inputting and Outputting Numbers Programming Example: A GUI Adding Machine Catching a NumberFormatExcepti on Chapter Summary Answers to Self-Test Questions Programming Projects CHAPTER 13 Applets and HTML CHAPTER 14 More Swing |
随便看 |
百科全书收录4421916条中文百科知识,基本涵盖了大多数领域的百科知识,是一部内容开放、自由的电子版百科全书。