所需积分/C币:16 2014-09-03 13:17:02 11.33MB PDF

Java初学者指南,包含Java SE 8的内容
BeginNew-Tight Java: A Beginner's Guide, Sixth Edition Herbert Schildt /925-2/ Front Matter Blind folio: About the author Best-selling author Herbert Schildt has written extensively about programming for nearly three decades and is a leading authority on the Java language. His books have sold millions of copies worldwide and have been translated into all major foreign languages. He is the author of numerous books on Java, including Java: The Complete Reference, Herb Schildts lava programming Cookbook, and Swing: A Beginner's Guide. He has also written extensively about C, C++, and C#t Although interested in all facets of computing, his primary focus is computer languages, including compilers, interpreters, and robotic control languages He also has an active interest in the standardization of languages. Schildt holds both graduate and undergraduate degrees from the university of Illinois. He can be reached at his consulting office at(217)586-4683 His About the Technical Reviewer Dr. Danny Coward has worked on all editions of the Java platform. He led the definition of Java Servlets into the first version of the Java ee platform and beyond, web services into the Java ME platform, and the strategy and planning for Java se 7. He founded JavaFX technology and, most recently designed the largest addition to the Java eE 7 standard, the Java Web Socket API From coding in Java, to designing APIs with industry experts, to serving for several years as an executive to the Java Community Process, he has a uniquely broad perspective into multiple aspects of Java technology Additionally, he is the author of Java Web Socket Programming and an upcoming book on Java EE. Dr. Coward holds a bachelors master's and doctorate in mathematics from the University of Oxford 00-FM indd 2 3/23/144:24AM BeginNew-Tight/ Java: A Beginner's Guide, Sixth Edition /Herbert Schildt/925-2/ Front Matter Blind folio: i TM A Beainner's Guide Sixth edition herbert schildt Mc Graw Education New York Chicago San francisco Athens London Madrid Mexico City Milan New Delhi Singapore Sydney Toronto 00-FM indd 3 3/23/144:24AM eginNew-Tight/ Java: A Beginner's Guide, Sixth Edition / Herbert Schildt/925-2 Copyright o 2014 by McGraw-Hill Education(Publisher). All rights reserved. Printed in the United States of America Except as permitted under the Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of publisher, with the exception that the program listings may be entered, stored, and executed in a computer system, but they may not be reproduced for publication ISBN:978-0-07-1809269 MHID:0-07-180926-0 e-book conversion by Cenveo Publisher Services sion 1.0 The material in this e-book also appears in the print version of this title: ISBN: 978-0-07-180925-2 MHID:0-07-180925-2 McGraw-Hill Education e-books are available at special quantity discounts to use as premiums and sales promotions, or for use in corporate training programs To contact a representative, please visit the Contact U Oracle and Java are registered trademarks of Oracle Corporation and/or its affiliates. All other trademarks are the property of their respective owners, and McGraw-Hill Education makes no claim of ownership by the mention of products that contain these mark Screen displays of copyrighted Oracle software programs have been reproduced herein with the permission of oracle Corporation and/or its affiliates Information has been obtained by McGraw-Hill Education from sources believed to be reliable. However, because of the possibility of human or mechanical error by our sources, McGraw-Hill Education, or others, McGraw-Hill Education does not guarantee the accuracy, adequacy, or completeness of any information and is not responsible for any errors or omissions or the results obtained from the use of such information Oracle Corporation does not make any representations or warranties as to the accuracy, adequacy, or completeness of any information contained in this Work, and is not responsible for any errors or omissions TERMS OF USE This is a copyrighted work and McGraw-Hill Education("McGraw-Hill)and its licensors reserve all rights in and to the work. Use of this work is subject to these terms. Except as permitted under the Copyright Act of 1976 and the right to store and retrieve one copy of the work, you may not decompile, disassemble, reverse engineer, reproduce, modify, create derivative works based upon, transmit, distribute, disseminate, sell, publish or sublicense the work or any part of it without McGraw-Hills prior consent. You may use the work for your own noncommercial and personal use; any other use of the work is strictly prohibited. Your right to use the work may be terminated if you fail to comply with these terms THE WORK IS PROVIDED"AS IS. MCGRAW-HILL AND ITS LICENSORS MAKE NO GUARANTEES OR WARRANTIES AS TO THE ACCURACY, ADEQUACY OR COMPLETENESS OF OR RESULTS TO BE OBTAINED FROM USING THE WORK INCLUDING ANY INFORMATION THAT CAN BE ACCESSED THROUGH THE WORK VIA HYPERLINK OR OTHERWISE AND EXPRESSLY DISCLAIM ANY WARRANTY EXPRESS OR IMPLIED INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. McGraw-Hill and its licensors do not warrant or guarantee that the functions contained in the work will meet your requirements or that its operation will be uninterrupted or error free. Neither McGraw-Hill nor its licensors shall be liable to you or anyone else for any inaccuracy, error or omission, regardless of cause, in the work or for any damages resulting therefrom. McGraw-Hill has no responsibility for the content of any information accessed through the work. Under no circumstances shall McGraw-Hill and/or its licensors be liable for any indirect, incidental special, punitive, consequential or similar damages that result from the use of or inability to use the work, even if any of them has been advised of the possibility of such damages. This limitation of liability shall apply to any claim or cause whatsoever whether such claim or cause arises in contract tort or otherwise e Book 925-2cr_pg indd 1 25/03/143:49PM BeginNew-Tight/Java: A Beginner's Guide, Sixth Edition /Herbert Schildt /925-2/ Front Matter Contents at a glance I Java fundamentals 2 Introducing Data Types and Operators 31 3 Program Control statements 63 4 Introducing Classes, Objects, and Methods 103 5 More Data Types and Operators 135 6 A Closer look at methods and classes 181 7 Inheritance 225 8 Packages and Interfaces 267 9 Exception Handling 299 10 Using 1/o 329 11 Multithreaded Programming 371 12 Enumerations, Autoboxing, Static Import, and Annotations 409 13 Generics 439 00-FM indd 3/23/144:24AM BeginNew-Tight/Java: A Beginner's Guide, Sixth Edition /Herbert Schildt /925-2/ Front Matter vi Java: A Beginner's Guide 14 Lambda Expressions and Method References 477 15 Applets, Events, and Miscellaneous Topics ................ 511 16 Introducing Swing 541 17 Introducing JavaFX 579 A Answers to Self Tests 615 B USing Java's Documentation Comments 673 Index 681 00-FM indd 6 3/23/144:24AM BeginNew-Tight / Java: A Beginner's Guide, SiXth Edition /Herbert Schildt /925-2/Front Matter Contents INTRODUCTION XIX 1 Java Fundamentals The Origins of Ja How Java relates to c and c++ How Java relates to c# Javas Contribution to the inte Java Applets…… Securit Portability Javas Magic: The Bytecode The java buzzwords Object-Oriented Programmin Encapsulation Polymorphism 9 Inheritance Obtaining the Java Development Kit 10 A First Simple Program 12 Entering the program 12 Compiling the program 13 The First Sample Program Line by Line 13 00-FM indd 7 3/23/144:24AM BeginNew-Tight/Java: A Beginner's Guide, Sixth Edition /Herbert Schildt /925-2/ Front Matter vili Java: A Beginner's Guide Handling syntax errors A Second Simple program 16 Another Data ty 18 Try This 1-1: Converting Gallons to Liters 20 Two Control statements 21 The if Statement 21 The for Loop 23 Create blocks of code Semicolons and Positioning 26 Indentation practices 26 Try This 1-2: Improving the gallons-to-Liters Converter 27 The Java Keywords∴… 28 Identifiers in java The java Class libraries Chapter 1 Self Test 2 Introducing Data Types and Operators……………………31 Why Data Types Are Important Java's Primitive Types 33 Floating-Point Types 35 Characters 5 The Boolean Type . ... 37 Try This 2-1: How Far Away Is the Lightning? 38 Literals 39 Hexadecimal, Octal, and binary literals Character Escape sequences String literals 41 a Closer look at variables 42 Initializing a variable 42 Dynamic Initialization 43 The Scope and lifetime of variables Operators 46 Arithmetic Operators 46 Increment and decrement 47 Relational and logical operators 48 Short-Circuit Logical operators 50 The assignment operator 51 Shorthand assignments 51 Type Conversion in Assignments Casting Incompatible Types 54 Operator Precedence 56 00-FM indd 8 3/23/144:24AM BeginNew-Tight / Java: A Beginner's Guide, Sixth Edition Herbert Schildt /925-2/ Front Mattel Contents Try This 2-2: Display a Truth Table for the Logical Operators 57 Expressions Type Conversion in Expressions 58 Spacing and Parentheses Chapter 2 Self Test 60 3 Program control statements e。。。。。。。。。ee。。鲁。。。。。。自。。。。。。。6。。。 63 Input Characters from the Keyboard 64 The if Statement 65 Nested ifs 67 The if-else-if Ladder The switch statement Nested switch statements Try This 3-1: Start Building a Java Help System 73 The for le 75 Some variations on the for Loop Missing pieces 78 The Infinite Loop 79 Loops with no bod 79 Declaring Loop Control Variables Inside the for Loop The Enhanced for Loop 81 The while l oop 81 The do-while Loop 83 Try This 3-2: Improve the Java Help Syst 85 Use break to Exit a Loop Use break as a Form of goto 89 Use continue 94 Try This 3-3: Finish the Java Help System Nested Loops 00 Chapter 3 Self Te 4 Introducing classes, Objects, and methods 103 Class fundamentals 104 The General Form of a class 105 Defining a class 106 How Objects Are Created Reference variables and Assignment ................................................109 Methods 110 Adding a Method to the vehicle class ...110 Returning from a Method l12 Returning a value 113 Using Parameters 115 Adding a Parameterized method to vehicle ....................................117 00-FM indd 9 3/23/144:24AM

试读 127P Java初学者指南

评论 下载该资源后可以进行评论 1

李小程 资源不错,谢谢分享,赞一个

关注 私信 TA的资源

    Java初学者指南 16积分/C币 立即下载


    16积分/C币 立即下载 >