Wrox beginning java 2 SDK 1 4 edition mar 2002 ISBN 1861005695 (1)

1.5K 126 0
Wrox beginning java 2 SDK 1 4 edition mar 2002 ISBN 1861005695  (1)

Đ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

Beginning Java 2, SDK 1.4 Edition by Ivor Horton ISBN:0764543652 Wrox Press � 2003 (1156 pages) This book outlines everything the beginning programmer needs to know to program with the Java programming language and the 1.4 Java Developer Kit With the release of JDK 1.4, programmers can look forward to achieving better performance than ever Table of Contents Beginning Java 2, SDK 1.4 Edition Chapter 1 - Introducing Java Programs, Data, Variables, and Chapter 2 Calculation Chapter 3 - Loops and Logic Chapter 4 - Arrays and Strings Chapter 5 - Defining Classes Extending Classes and Chapter 6 Inheritance Chapter 7 - Exceptions Chapter 8 - Understanding Streams Chapter 9 - Accessing Files and Directories Chapter 10 - Writing Files Chapter 11 - Reading Files Chapter 12 - Serializing Objects Chapter 13 - Collection Classes Chapter 14 - A Collection of Useful Classes Chapter 15 - Threads Chapter 16 Chapter 17 Chapter 18 Chapter 19 Chapter 20 Chapter 21 - Creating Windows - Handling Events - Drawing in a Window - Extending the GUI - Filing and Printing Documents - Java and XML Creating and Modifying XML Chapter 22 Documents Appendix A - Keywords Appendix B - Computer Arithmetic Data types, Keywords and Index of Operators Classes, Exceptions, Interfaces Index of and Methods Beginning Java 2, SDK 1.4 Edition Ivor Horton Wrox Press Ltd đ â 2002 Wrox Press All rights reserved No part of this book may be reproduced, stored in a retrieval system or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embodied in critical articles or reviews The author and publisher have made every effort in the preparation of this book to ensure the accuracy of the information However, the information contained in this book is sold without warranty, either express or implied Neither the authors, Wrox Press, nor its dealers or distributors will be held liable for any damages caused or alleged to be caused either directly or indirectly by this book Published by Wrox Press Ltd, Arden House, 1102 Warwick Road, Acocks Green, Birmingham, B27 6BH, UK Printed in the United States ISBN 1-861005-69-5 Trademark Acknowledgements Wrox has endeavored to provide trademark information about all the companies and products mentioned in this book by the appropriate use of capitals However, Wrox cannot guarantee the accuracy of this information Credits Author Technical Reviewers Ivor Horton Technical Editors Mankee Cheng Shivanand Nadkarni Girish Sharangpani Roberts Shaw Andrew Tracey Commissioning Editors Louay Fatoohi Chanoch Wiggers Index John Collins Andrew Criddle Project Manager Emma Batch Proof Readers Lisa Stephenson Fiona Berryman Steve Baker Robert Chang Phil Powers De George Justin Foley David Hudson Jim MacIntosh Craig McQueen Karen Ritchie Gavin Smyth John Timney David Whitney Production Coordinator Natalie O'Donnell Illustrations Pippa Wonson Rachel Taylor Cover Design Chris Morris Agnes Wiggers Keith Westmooreland Cover photograph by John Wright Photography, Warwick A Note from the Author In all my Beginning… books, my objective is to minimize what, in my judgment, are the three main hurdles the aspiring programmer must face: getting to grips with the jargon that pervades every programming language and environment, understanding the use of the language elements (as opposed to what they are), and appreciating how the language is applied in a practical context Jargon is an invaluable and virtually indispensable means of communication for the competent amateur as well as the expert professional, so it can't be avoided My approach is to ensure that the beginner understands what the jargon means and gets comfortable with using it in context In that way, they can use the documentation that comes along with most programming products more effectively, and can also feel competent to read and learn from the literature that surrounds most programming languages Comprehending the syntax and effects of the language elements are obviously essential to learning a language, but I believe illustrating how the language features work and how they are used are equally important Rather than just use code fragments, I always try to provide the reader with practical working examples that show the relationship of each language feature to specific problems These can then be a basis for experimentation, to see at first hand the effects of changing the code in various ways The practical context needs to go beyond the mechanics of applying individual language elements To help the beginner gain the competence and confidence to develop their own applications, I aim to provide them with an insight into how things work in combination and on a larger scale than a simple example with a few lines of code That's why I like to have at least one working example that builds over several chapters In that way it's possible to show something of the approach to managing code as well as how language features can be applied together Finally, I know the prospect of working through a book of doorstop proportions can be quite daunting For that reason it's important for the beginner to realize three things that are true for most programming languages First, there is a lot to it, but this means there will be a greater sense of satisfaction when you've succeeded Second, it's great fun, so you really will enjoy it Third, it's a lot easier than you think, so you positively will make it Ivor Horton Chapter 1: Introducing Java Overview This chapter will give you an appreciation of what the Java language is all about Understanding the details of what we'll discuss in this chapter is not important at this stage; you will see all of them again in greater depth in later chapters of the book The intent of this chapter is to introduce you to the general ideas that underpin what we'll be covering through the rest of the book, as well as the major contexts in which Java programs can be used and the kind of program that is applicable in each context In this chapter you will learn: The basic characteristics of the Java language How Java programs work on your computer Why Java programs are portable between different computers The basic ideas behind object-oriented programming How a simple Java program looks and how you can run it using the Java Development Kit What HTML is and how it is used to include a Java program in a web page What is Java All About? Java is an innovative programming language that has become the language of choice for programs that need to run-on a variety of different computer systems First of all Java enables you to write small programs called applets These are programs that you can embed in Internet web pages to provide some intelligence Being able to embed executable code in a web page introduces a vast range of exciting possibilities Instead of being a passive presentation of text and graphics, a web page can be interactive in any way that you want You can include animations, games, interactive transaction processing – the possibilities are almost unlimited Of course, embedding program code in a web page creates special security requirements As an Internet user accessing a page with embedded Java code, you need to be confident that it will not do anything that might interfere with the operation of your computer, or damage the data you have on your system This implies that execution of the embedded code must be controlled in such a way that it will prevent accidental damage to your computer environment, as well as ensure that any Java code that was created with malicious intent is effectively inhibited Java implicitly incorporates measures to minimize the possibility of such occurrences arising with a Java applet Java also allows you to write large-scale application programs that you can run unchanged on any computer with an operating system environment in which the language is supported This applies to the majority of computers in use today You can even write programs that will work both as ordinary applications and as applets Java has matured immensely in recent years, particularly with the introduction of Java 2 The breadth of function provided by the standard core Java has grown incredibly Java provides you with comprehensive facilities for building application with an interactive GUI, extensive image processing and graphics programming facilities, as well as support for accessing relational databases and communicating with remote computers over a network Release 1.4 of Java added a very important additional capability, the ability to read and write XML Just about any kind of application can now be programmed effectively in Java, with the implicit plus of complete portability Features of the Java Language The most important characteristic of Java is that it was designed from the outset to be machine independent Java programs can run unchanged on any operating system that supports Java Of course there is still the slim possibility of the odd glitch as you are ultimately dependent on the implementation of Java on any particular machine, but Java programs are intrinsically more portable than programs written in other languages An application written in Java will only require a single set of sourcecode, regardless of the number of different computer platforms on which it is run In any other programming language, the application will frequently require the sourcecode to be tailored to accommodate different computer environments, particularly if there is an extensive graphical user interface involved Java offers substantial savings in time and resources in developing, supporting, and maintaining major applications on several different hardware platforms and operating systems Possibly the next most important characteristic of Java is that it is object oriented The object-oriented approach to programming is also an implicit feature of all Java programs, so we will be looking at what this implies later in this chapter Object-oriented programs are easier to understand, and less time-consuming to maintain and extend than programs that have been written without the benefit of using objects Not only is Java object oriented, but it also manages to avoid many of the difficulties and complications that are inherent in some other object-oriented languages, making it easy to learn and very straightforward to use It lacks the traps and 'gotchas' that arise in some other programming languages This makes the learning cycle shorter and you need less real-world coding experience to gain competence and confidence It also makes Java code easier to test Java has a built-in ability to support national character sets You can write Java programs as easily for Greece or Japan, as you can for English speaking countries always assuming you are familiar with the national languages involved, of course You can even build programs from the outset to support several different national languages with automatic adaptation to the environment in which the code executes ... Arden House, 11 02 Warwick Road, Acocks Green, Birmingham, B27 6BH, UK Printed in the United States ISBN 1- 8 610 05-69-5 Trademark Acknowledgements Wrox has endeavored to provide trademark information about... Chapter 22 Documents Appendix A - Keywords Appendix B - Computer Arithmetic Data types, Keywords and Index of Operators Classes, Exceptions, Interfaces Index of and Methods Beginning Java 2, SDK 1. 4. ..Chapter 16 Chapter 17 Chapter 18 Chapter 19 Chapter 20 Chapter 21 - Creating Windows - Handling Events - Drawing in a Window - Extending the GUI - Filing and Printing Documents - Java and XML

Ngày đăng: 26/03/2019, 16:27

Mục lục

  • Table of Contents

  • Intruction

  • Chap01: Introducing Java

    • What is Java All About

    • Learning Java

    • The Java environment

    • Object-Oriented Programming in Java

    • Java Program Structure

    • Java and Unicode

    • Summary

    • Resources

    • Chap02: Programs, Data, variables, and Calculation

      • Data and Variables

      • Integer Data Types

      • Floating Point Data Types

      • Arithmetic Calculations

      • Mixed Arithmetic Expressions

      • The op= Operators

      • Mathematical Functions and Constants

      • Storing Characters

      • Bitwise Operations

      • Boolean Variables

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan