Learn java

Solo disponible en BuenasTareas
  • Páginas : 279 (69633 palabras )
  • Descarga(s) : 0
  • Publicado : 24 de agosto de 2012
Leer documento completo
Vista previa del texto
JAVA ts en d tu S
FO R

th six ition ed

DOUGLAS BELL & MIKE PARR

Java for Students
Visit the Java for Students, sixth edition Companion Website at www.pearsoned.co.uk/bell to find valuable student learning material including:
n n n

How to download Java 6.0 Programs from the book An extra chapter on Java network programming

We work with leading authors to develop the strongesteducational materials in computing, bringing cutting-edge thinking and best learning practice to a global market. Under a range of well-known imprints, including Prentice Hall, we craft high quality print and electronic publications which help readers to understand and apply their content, whether studying or at work. To find out more about the complete range of our publishing, please visit us onthe World Wide Web at: www.pearsoned.co.uk

Java
for Students
DOUGLAS BELL MIKE PARR
Sixth edition

Pearson Education Limited Edinburgh Gate Harlow Essex CM20 2JE England and Associated Companies throughout the world Visit us on the World Wide Web at: www.pearsoned.co.uk Sixth edition published 2010 © Prentice Hall Europe 1998 © Pearson Education Limited 2001, 2010 The rights of DouglasBell and Mike Parr to be identified as authors of this work have been asserted by them in accordance with the Copyright, Designs and Patents Act 1988. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, electronic, mechanical, photocopying, recording or otherwise, without either the prior written permission ofthe publisher or a licence permitting restricted copying in the United Kingdom issued by the Copyright Licensing Agency Ltd, Saffron House, 6–10 Kirby Street, London EC1N 8TS. All trademarks used herein are the property of their respective owners. The use of any trademark in this text does not vest in the author or publisher any trademark ownership rights in such trademarks, nor does the use of suchtrademarks imply any affiliation with or endorsement of this book by such owners. ISBN: 978-0-273-73122-1 British Library Cataloguing-in-Publication Data A catalogue record for this book is available from the British Library Library of Congress Cataloging-in-Publication Data Bell, Doug, 1944– Java for students / Douglas Bell, Mike Parr. – 6th ed. p. cm. Includes index. ISBN 978-0-273-73122-1(pbk.) 1. Java (Computer program language) I. Parr, Mike, 1949– II. Title. QA76.73.J38B45 2010 005.13′3–dc22 2009051149 10 9 8 7 6 5 4 3 2 1 14 13 12 11 10 Typeset in 9.75/12pt Galliard by 35 Printed in Great Britain by Henry Ling Ltd., at the Dorset Press, Dorchester, Dorset The publisher’s policy is to use paper manufactured from sustainable forests.

Contents

Detailed contents IntroductionGuided tour 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 The background to Java First programs Using graphics methods Variables and calculations Methods and parameters Using objects Selection Repetition Writing classes Inheritance Calculations Array lists Arrays Arrays – two dimensional String manipulation Exceptions Files and console applications Object-oriented design Program style

vii xixxxiv 1 8 22 35 60 88 115 152 171 194 210 228 242 265 278 301 318 348 369
v

vi

Contents

20 21 22 23 24 25 26

Testing Debugging Threads Interfaces Programming in the large – packages Polymorphism Java in context

383 397 406 416 426 432 441 454 522

Appendices Index

Detailed contents

Introduction Guided tour

xix xxiv 1 1 2 3 5 5 6 6 7 8 8 9 9 10 13 14 15 16 17 19 19 20

1The background to Java
The history of Java The main features of Java What is a program? Programming principles Programming pitfalls Summary Exercises Answers to self-test questions

2 First programs
Introduction Integrated development environments Files and folders Creating a Java program The libraries Demystifying the program Objects, methods: an introduction Classes: an analogy Using a...
tracking img