1. Trang chủ
  2. » Công Nghệ Thông Tin

ABSOLUTE JAVA™ 5 th Edition pot

1,3K 7,4K 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 1.306
Dung lượng 9,99 MB

Nội dung

[...]... catch Blocks 55 1 PITFALL: Catch the More Specific Exception First 55 3 9.2 54 6 THROWING EXCEPTIONS IN METHODS 55 6 Throwing an Exception in a Method 55 6 Declaring Exceptions in a throws Clause 55 8 Exceptions to the Catch or Declare Rule 56 1 throws Clause in Derived Classes 56 2 When to Use Exceptions 56 3 Event-Driven Programming ★ 56 4 9.3 MORE PROGRAMMING TECHNIQUES FOR EXCEPTION HANDLING 56 6 PITFALL:... 350 TIP: Use for Loops with Arrays 352 PITFALL: Array Indices Always Start with Zero 352 PITFALL: Array Index Out of Bounds 352 Initializing Arrays 353 PITFALL: An Array of Characters Is Not a String 355 6.2 ARRAYS AND REFERENCES 356 Arrays Are Objects 356 PITFALL: Arrays with a Class Base Type 358 Array Parameters 358 PITFALL: Use of = and == with Arrays 360 Arguments for the Method main ★ 3 65 Methods... Exercises 51 6 Programming Projects 51 8 Chapter 9 9.1 Exception Handling 52 3 EXCEPTION HANDLING BASICS 52 5 try-catch Mechanism 52 5 Exception Handling with the Scanner Class 52 7 TIP: Exception Controlled Loops 52 8 Throwing Exceptions 53 0 EXAMPLE: A Toy Example of Exception Handling 53 2 Exception Classes 53 7 Exception Classes from Standard Packages 53 8 Defining Exception Classes 54 0 TIP: Preserve getMessage 54 4... Blocks 56 6 The finally Block ★ 56 6 Rethrowing an Exception ★ 56 8 The AssertionError Class ★ 56 8 ArrayIndexOutOfBoundsException 56 9 Contents Chapter Summary 56 9 Answers to Self-Test Exercises 57 0 Programming Projects 57 4 Chapter 10 10.1 File I/O 57 7 INTRODUCTION TO FILE I/O 57 8 Streams 57 8 Text Files and Binary Files 10.2 TEXT FILES 57 9 58 0 Writing to a Text File 58 0 PITFALL: A try Block Is a Block 58 6... Downcasting 50 1 496 xxi xxii Contents TIP: Checking to See Whether Downcasting Is Legitimate ★ 50 1 A First Look at the clone Method 50 4 PITFALL: Sometimes the clone Method Return Type Is Object 50 5 PITFALL: Limitations of Copy Constructors ★ 50 6 8.2 ABSTRACT CLASSES 50 9 Abstract Classes 51 0 PITFALL: You Cannot Create Instances of an Abstract Class TIP: An Abstract Class Is a Type 51 5 51 4 Chapter Summary 51 6... EXAMPLE: A Linked List with a Deep Copy clone Method ★ 832 TIP: Cloning Is an “All or Nothing” Affair 8 35 15. 3 ITERATORS 8 35 Defining an Iterator Class 836 Adding and Deleting Nodes 841 15. 4 VARIATIONS ON A LINKED LIST 846 Doubly Linked List 846 The Stack Data Structure 855 The Queue Data Structure 857 Running Times and Big-O Notation Efficiency of Linked Lists 8 65 15. 5 HASH TABLES WITH CHAINING 860 866... Overwriting an Output File 58 6 Appending to a Text File 58 7 TIP: toString Helps with Text File Output 58 8 Reading from a Text File 58 9 Reading a Text File Using Scanner 58 9 Testing for the End of a Text File with Scanner 59 2 Reading a Text File Using BufferedReader 59 9 TIP: Reading Numbers with BufferedReader 603 Testing for the End of a Text File with BufferedReader 603 Path Names 6 05 Nested Constructor... Programming Projects 10 75 Chapter 19 19.1 10 65 10 65 1071 Java Never Ends 1079 MULTITHREADING 1080 EXAMPLE: A Nonresponsive GUI 1081 Thread.sleep 1081 The getGraphics Method 10 85 Fixing a Nonresponsive Program Using Threads 1086 EXAMPLE: A Multithreaded Program 1086 The Class Thread 1087 The Runnable Interface ★ 1090 Race Conditions and Thread Synchronization ★ 1093 19.2 NETWORKING WITH STREAM SOCKETS 1098... about Methods 180 TIP: Any Method Can Be Used as a void Method 184 Local Variables 186 Blocks 187 TIP: Declaring Variables in a for Statement 188 Parameters of a Primitive Type 188 PITFALL: Use of the Terms “Parameter” and “Argument” 1 95 Simple Cases with Class Parameters 197 The this Parameter 197 Methods That Return a Boolean Value 199 The Methods equals and toString 202 Recursive Methods 2 05 TIP:... However, this book, and many other books and programmers, consider Java a general-purpose programming language that is suitable for most any application, whether it involves the Internet or not The first version of Java was neither of these things, but it evolved into both In 1991, James Gosling led a team at Sun Microsystems that developed the first version of Java (which was not yet called Java) This . progressed to these more advanced topics. CHANGES IN THIS EDITION This fifth edition presents the same programming philosophy as the fourth edition. For instructors, you can teach the same course,. class="bi x0 y0 w0 h0" alt="" This page intentionally left blank ABSOLUTE JAVA ™ 5 th Edition This page intentionally left blank ABSOLUTE JAVA ™ 5 th Edition Walter Savitch. the same topics in the same order with no changes in the material covered or the chapters assigned. The changes to this edition consist almost exclusively of supplementary material added to the

Ngày đăng: 28/03/2014, 21:20

TỪ KHÓA LIÊN QUAN