Starting out with java early OBjects 5th global edtiion by gaddis

1.2K 219 0
Starting out with java early OBjects 5th global edtiion by gaddis

Đ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

Starting Out with Java Early Objects For these Global Editions, the editorial team at Pearson has collaborated with educators across the world to address a wide range of subjects and requirements, equipping students with the best possible learning tools This Global Edition preserves the cutting-edge approach and pedagogy of the original, but also features alterations, customization, and adaptation from the North American version FIFTH edition Gaddis This is a special edition of an established title widely used by colleges and universities throughout the world Pearson published this exclusive edition for the benefit of students outside the United States and Canada If you purchased this book within the United States or Canada you should be aware that it has been imported without the approval of the Publisher or Author Global edition Global edition Global edition Starting Out with Java Early Objects FIFTH edition Tony Gaddis Pearson Global Edition Gaddis_1292076046_mech.indd 01/08/14 3:13 pm ONLINE ACCESS Thank you for purchasing a new copy of Starting Out with Java: Early Objects, Fifth Edition Your textbook includes one year of prepaid access to the book’s Companion Website This prepaid subscription provides you with full access to the following student support areas: • online appendices • VideoNotes Use a coin to scratch off the coating and reveal your student access code Do not use a knife or other sharp object as it may damage the code To access the Starting Out with Java: Early Objects, Fifth Edition Companion Website for the first time, you will need to register online using a computer with an Internet connection and a web browser The process takes just a couple of minutes and only needs to be completed once Go to www.pearsonglobaleditions.com/Gaddis Click on Companion Website Click on the Register button On the registration page, enter your student access code* found beneath the scratch-off panel Do not type the dashes You can use lower- or uppercase Follow the on-screen instructions If you need help at any time during the online registration process, simply click the Need Help? icon Once your personal Login Name and Password are confirmed, you can begin using the Starting Out with Java: Early Objects, Fifth Edition Companion Website To log in after you have registered: You only need to register for this Companion Website once After that, you can log in any time at www.pearsonglobaleditions.com/Gaddis by providing your Login Name and Password when prompted *Important: The access code can only be used once This subscription is valid for one year upon activation and is not transferable If this access code has already been revealed, it may no longer be valid Gaddis_1292076046_ifc.indd 01/08/14 3:14 pm A01_GADD6041_05_GE_FM.indd Page 31/07/14 6:41 PM user /203/PH01468_GE/9781292076041_GADDIS/GADDIS_STARTING_OUT_WITH_JAVA_EARLY_OBJECTS5 LOCATION OF VIDEONOTES IN THE TEXT Chapter 1 Compiling and Running a Java Program, p 36 Using an IDE, p 36 Your First Java Program, p 50 VideoNote Chapter 2 Displaying Console Output, p 59 Declaring Variables, p 66 Simple Math Expressions, p 82 The Miles-per-Gallon Problem, p 146 Chapter 3 Writing Classes and Creating Objects, p 155 Initializing an Object with a Constructor, p 177 The Personal Information Class Problem, p 210 Chapter 4 The if Statement, p 215 The if-else Statement, p 224 The if-else-if Statement, p 239 The Time Calculator Problem, p 295 Chapter 5 The while Loop, p 301 The Pennies for Pay Problem, p 371 Chapter 6 Returning Objects from Methods, p 411 Aggregation, p 423 The InventoryItem Class Copy Constructor Problem, p 464 Chapter 7 Accessing Array Elements in a Loop, p 476 Passing an Array to a Method, p 494 The Charge Account Validation Problem, p 562 Chapter 8 The Sentence Capitalizer Problem, p 621 Chapter 9 Inheritance, p 627 Polymorphism, p 668 The Employee and Production-worker Classes Problem, p 697 Chapter 10 Handling Exceptions, p 703 The Exception Project Problem, p 759 Chapter 11 Creating a Simple GUI Application, p 775 Handling Events, p 785 The Monthly Sales Tax Problem, p 858 Chapter 12 The JList Component, p 864 The JcomboBox Component, p 881 The Image Viewer Problem, p 925 (continued on the next page) A01_GADD6041_05_GE_FM.indd Page 31/07/14 6:41 PM user /203/PH01468_GE/9781292076041_GADDIS/GADDIS_STARTING_OUT_WITH_JAVA_EARLY_OBJECTS5 LOCATION OF VIDEONOTES IN THE TEXT (continued) Chapter 13 Creating an Applet, p 943 The House Applet Problem, p 1002 VideoNote Chapter 14 Using Scene Builder to Create the Kilometer Converter GUI, p 1012 Learning More About the Main Application Class, p 1024 Writing the Main Application Class For the Kilometer Converter GUI, p 1025 Learning More About the Controller Class, p 1027 Registering the Controller Class to the Application’s GUI, p 1028 JavaFX RadioButtons, p 1033 JavaFX CheckBoxes, p 1041 The Retail Price Calculator Problem, p 1056 Chapter 15 Reducing a Problem with Recursion, p 1064 The Recursive Power Problem, p 1087 A01_GADD6041_05_GE_FM.indd Page 31/07/14 6:41 PM user /203/PH01468_GE/9781292076041_GADDIS/GADDIS_STARTING_OUT_WITH_JAVA_EARLY_OBJECTS5 Starting Out with Java TM Early Objects fif T H edition G lo b al edition A01_GADD6041_05_GE_FM.indd Page 31/07/14 6:41 PM user /203/PH01468_GE/9781292076041_GADDIS/GADDIS_STARTING_OUT_WITH_JAVA_EARLY_OBJECTS5 A01_GADD6041_05_GE_FM.indd Page 06/08/14 9:51 PM user /203/PH01468_GE/9781292076041_GADDIS/GADDIS_STARTING_OUT_WITH_JAVA_EARLY_OBJECTS5 Starting Out with Java TM Early Objects fifTH edition Global edition Tony Gaddis Haywood Community College Global Edition contributions by Vikas Deep Dhiman Amity University Boston  Columbus  Indianapolis  New York  San Francisco  Upper Saddle River Amsterdam  Cape Town  Dubai  London  Madrid  Milan  Munich  Paris  Montreal  Toronto Delhi  Mexico City  São Paulo  Sydney  Hong Kong  Seoul  Singapore  Taipei  Tokyo A01_GADD6041_05_GE_FM.indd Page 19/08/14 5:57 PM user /203/PH01468_GE/9781292076041_GADDIS/GADDIS_STARTING_OUT_WITH_JAVA_EARLY_OBJECTS5 Vice President and Editorial Director, ECS: Marcia J Horton Acquisitions Editor: Matt Goldstein Program Manager: Kayla Smith-Tarbox Executive Marketing Manager: Christy Lesko Marketing Assistant: Jon Bryant Permissions Project Manager: Karen Sanatar, Brooks Hill-Whilton Senior Managing Editor: Scott Disanno Production Project Manager: Greg Dulles Operations Specialist: Linda Sager Head of Learning Asset Acquisition, Global Edition: Laura Dent Media Producer, Global Edition: M Vikram Kumar Editor, Acquisitions, Global Edition: Aditee Agarwal Senior Manufacturing Controller, Global Edition: Trudy Kimber Project Editor, Global Edition: Priyanka Shivadas Cover Designer: Lumina Datamatics Cover Photo: â Michaela Brandl/Shutterstock Composition: Aptarađ, Inc Printer/Binder: Courier/Kendallville Cover Printer: Moore Langen Typeface: 10/12.5 Sabon LT Std Pearson Education Limited Edinburgh Gate Harlow Essex CM 20 2JE England and Associated Companies throughout the world Visit us on the World Wide Web at: www.pearsonglobaleditions.com © Pearson Education Limited 2015 The rights of Tony Gaddis to be identified as the author of this work have been asserted by him in accordance with the Copyright, Designs and Patents Act 1988 Authorized adaptation from the United States edition, entitled Starting Out with Java: Early Objects 5th Edition, ISBN 978-0-133-77674-4, by Tony Gaddis, published by Pearson Education © 2015 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 of the publisher or a license 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 such trademarks imply any affiliation with or endorsement of this book by such owners ISBN 10: 1-292-07604-6 ISBN 13: 978-1-292-07604-1 British Library Cataloguing-in-Publication Data A catalogue record for this book is available from the British Library 14 13 12 11 10 Typeset by Aptara®, Inc in Sabon LT Std 10/12.5 pt Printed and Bound in Courier Kendallville A01_GADD6041_05_GE_FM.indd Page 31/07/14 6:42 PM user /203/PH01468_GE/9781292076041_GADDIS/GADDIS_STARTING_OUT_WITH_JAVA_EARLY_OBJECTS5 Contents in Brief Preface  15 Chapter Introduction to Computers and Java 23 Chapter Java Fundamentals 53 Chapter A First Look at Classes and Objects 151 Chapter Decision Structures 215 Chapter Loops and Files 301 Chapter A Second Look at Classes and Objects 379 Chapter Arrays and the ArrayList Class 471 Chapter Text Processing and Wrapper Classes 569 Chapter Inheritance 627 Chapter 10 Exceptions and Advanced File I/O 703 Chapter 11 GUI Applications—Part 761 Chapter 12 GUI Applications—Part 863 Chapter 13 Applets and More 931 Chapter 14 Creating GUI Applications with JavaFX 1005 Chapter 15 Recursion 1061 Chapter 16 Databases 1089 Appendix A Getting Started with Alice 1185 Index 1211 Credits 1227 Appendixes B–M Available on the book’s online resource page  Case Studies 1–5 Available on the book’s online resource page  A01_GADD6041_05_GE_FM.indd Page 31/07/14 6:42 PM user /203/PH01468_GE/9781292076041_GADDIS/GADDIS_STARTING_OUT_WITH_JAVA_EARLY_OBJECTS5 Z19_GADD6041_05_GE_IDX.indd Page 1218 31/07/14 7:04 PM user /203/PH01468_GE/9781292076041_GADDIS/GADDIS_STARTING_OUT_WITH_JAVA_EARLY_OBJECTS5 www.downloadslide.net 1218 Index javax.swing package, 763, 764, 776, 797, 832, 866, 871, 887, 896, 898, 900, 943, 987 javax.swing.event package, 866, 914 JButton class, 780, 783, 786, 790 addActionListener method, 787, 791 constructor, 888 image, displaying, 888–892 setActionCommand method, 796 setIcon method, 889 JCheckBox class, 826–830 constructors, 826 doClick method, 830 isSelected method, 827 item event, responding to, 826–827 JCheckBoxMenuItem class, 900 JColorChooser class, 898 showDialog method, 898 JComboBox class, 881–886 action events, responding to, 881 constructor, 881 editable, 885–896 getSelectedIndex method, 882, 886 getSelectedItem method, 882, 886 setEditable method, 885–886 uneditable, 885 JComponent class, 832 setFont method, 911 setPreferredSize method, 906 setToolTipText method, 895 JDBC (Java Database Connectivity), 1090–1091 auto commit mode, 1175 deleting rows with, 1125 inserting rows with, 1121–1122 new database creation with, 1136–1137 updating rows with, 1124–1128 JFC (Java Foundation Classes), 761, 762–763 JFileChooser class, 896–897 APPROVE_OPTION constant, 897 CANCEL_OPTION constant, 897 constructors, 896 ERROR_OPTION constant, 897 showOpenDialog method, 897 showSaveDialog method, 897 JFrame class, 775–776, 783, 809, 834 constructor, 776, 778, 784 content pane color, 801–802 EXIT_ON_CLOSE constant, 777 extending, 777–778 getContentPane method, 802 HIDE_ON_CLOSE constant, 777 paint method, 958 repaint method, 970 setDefaultCloseOperation method, 777 setLayout method, 803 setSize method, 777, 784 setVisible method, 777, 784 JLabel class, 780, 783 constructor, 784, 887, 888 image, displaying, 887–892 setIcon method, 888 JList class, 864–880 addListSelectionListener method, 866 border, placing around, 870 constructor, 864 getSelectedIndex method, 866–867, 876 getSelectedValue method, 866, 876 list selection events, responding to, 866 multiple interval selection mode, 865–866, 876–877 MULTIPLE_INTERVAL_SELECTION constant, 866, 876–877 selection modes, 865–866 setListData method, 875–876 setSelectionMode method, 866, 876 single interval selection mode, 865–866, 876 single selection mode, 865–866 SINGLE_INTERVAL_SELECTION constant, 866, 876 SINGLE_SELECTION constant, 866 JMenu class, 900 JMenuBar class, 900 JMenuItem class, 900 JOptionPane class, 119–126, 764–774, 775, 791 CANCEL_OPTION constant, 771 ERROR_MESSAGE constant, 766–767 INFORMATION_MESSAGE constant, 766–767 input dialog, 119–121 input dialog box, 764, 768–769 message dialog, 119–120 message dialog box, 764–768 NO_OPTION constant, 771 PLAIN_MESSAGE constant, 766–767 QUESTION_MESSAGE constant, 766–767 showConfirmDialog method, 769–771 showInputDialog method, 121, 122, 768–769 showMessageDialog method, 120, 764–768 WARNING_MESSAGE constant, 766–767 YES_OPTION constant, 771 JPanel class, 781, 783, 784, 970–971 extending, 834–847 paintComponent method, 970–971, 975 JRadioButton class, 819–825 action events, responding to, 821–825 constructor, 820 doClick method, 825 isSelected method, 825 JRadioButtonMenuItem class, 900 constructor, 906 JScrollPane class, 871–875 constructor, 871 HORIZONTAL_SCROLLBAR_ALWAYS constant, 909 HORIZONTAL_SCROLLBAR_AS_NEEDED constant, 909 HORIZONTAL_SCROLLBAR_NEVER constant, 909 setHorizontalScrollBarPolicy method, 909 setVerticalScrollBarPolicy method, 909 VERTICAL_SCROLLBAR_ALWAYS constant, 910 VERTICAL_SCROLLBAR_AS_NEEDED constant, 909 VERTICAL_SCROLLBAR_NEVER constant, 910 JSlider class, 913–917 change event, responding to, 914 constructor, 913–914 getValue method, 914 setMajorTickSpacing method, 914 setMinorTickSpacing method, 914 setPaintLabels method, 914 setPaintTicks method, 914 JTable class, 1142–1153 colNames parameter, 1142 rowData parameter, 1142 JTextArea class, 908–910 constructors, 908 getText method, 909 setLineWrap method, 910 setText method, 909 setWrapStyleWord method, 910 Z19_GADD6041_05_GE_IDX.indd Page 1219 31/07/14 7:04 PM user /203/PH01468_GE/9781292076041_GADDIS/GADDIS_STARTING_OUT_WITH_JAVA_EARLY_OBJECTS5 www.downloadslide.net JTextField class, 780, 783, 784, 791, 863–864 setEditable method, 863–864 JVM See Java Virtual Machine (JVM) K key words, 31, 32, 69 keyboard buffer, 117 keyboard input, reading, 111–119 KeyEvent class, 893, 894 L Label class, 951 label component, 762 See also JLabel class Label component, JavaFX GUI, 1006, 1008 late binding, 669–670 layout managers, 802–819 adding to container, 803 BorderLayout class, 803, 806–813 FlowLayout class, 803–806 GridLayout class, 803, 813–819 leading zeros, padding numbers with, 134–135 leaf node, scene graph, 1007, 1008 left to right associativity, 85–86 left-justified numbers, 136 lexicographical comparison, 255 lightweight components, 763 LIKE operator (SQL), 1114–1115 line border, 833–834 line wrapping, 888 lines, 33 list component, 762, 864–880, 1006 See also JList class adding scroll bar to, 871–875 border around, placing, 832 ListSelectionListener interface valueChanged method, 866 ListSelectionModel class, 866 literal(s), 68–69 character, 77–78 floating-point, 75 integer, 74 string, 56, 98 local variable, 104, 194 logical errors, 39 logical operators, 244–251, 1115–1116 ! (NOT), 244, 249 && (AND), 244, 245–247 || (OR), 244, 247–248 associativity, 249–250 checking numeric ranges, 250–251 precedence, 249–250 short-circuit evaluation, 245 Long class, 609 MAX_VALUE constant, 611 MIN_VALUE constant, 611 parseLong method, 610 toBinaryString method, 610–611 toHexString method, 610–611 toOctalString method, 610–611 toString method, 610 look and feel, 917–919 loop arrays, with, 487–488 body, 306 control variable, 308 count-controlled, 318–319 Index deciding which to use, 342 defined, 305 do-while, 315–318 for, 318–328 header, 305, 319 infinite, 308–309 iteration, 307 nested, 334–341 pretest, 308 programming style, 309–310 user-controlled, 318 while, 305–315 lowered bevel border, 833 M main application class, JavaFX writing code for, 1023–1025 main memory, 24, 26 main method GUI classes equipping with, 779–780 MalformedURLException class, 995 many to one relationship, 1155 markup language, 934 Math class, 89–90, 385 PI constant, 97–98 pow method, 89–90 sqrt method, 90 matte border, 833 MAX function (SQL), 1117 MAX_VALUE constant, 611 menus, 899–907 check box menu item, 899 See also JCheckBoxMenuItem class menu bar, 899 See also JMenuBar class menu item, 899 See also JMenuItem class radio button menu item, 900 See also JRadioButtonMenuItem class separator bar, 900 submenu, 900 message dialog box, 764–768 meta data, 1139–1142 method(s), 41, 55–56, 151 accessor, 168 abstract, 673–679 binding, 669–670 DataInputStream class, 738 DataOutputStream class, 736 equals, 667–668 exit, 774, 777 final, 654 getMessage, 710–712, 726, 728 Graphics class, 957–958 header, 55 main See main method mutator, 168 overloading vs overriding, 651–653 overriding, 646–654 recursive See recursion ResultSet class, 1138 setDefaultCloseOperation, 777, 784 setSize, 777, 784 setVisible, 777, 784 showConfirmDialog, 769–771 showInputDialog, 768–769 showMessageDialog, 764, 765 signature, 649 toString, 667–668 1219 Z19_GADD6041_05_GE_IDX.indd Page 1220 31/07/14 7:04 PM user /203/PH01468_GE/9781292076041_GADDIS/GADDIS_STARTING_OUT_WITH_JAVA_EARLY_OBJECTS5 www.downloadslide.net 1220 Index Metric class, 385 MIN function (SQL), 1117 MIN_VALUE constant, 611 minimum field width, 130–132 mnemonics, 893–894 modal dialog box, 768 mouse events, 976–986 mouse listener, 976 mouse motion listener, 976 MouseAdapter class, 984 MouseEvent class, 978 getX method, 977 getY method, 977 MouseListener interface, 976–977 mouseClicked method, 977 mouseEntered method, 977 mouseExited method, 977 mousePressed method, 977 mouseReleased method, 977 MouseMotionAdapter class, 984 MouseMotionListener interface, 977–978 mouseDragged method, 978 mousemoved method, 978 multi-catch, 723 multiline comments, 106–107 multithreaded application, 600 mutator methods, 168 N named constants, 96–98 names, programmer-defined, 31–32, 69–70 naming rules, 69–70 narrowing conversion, 93 negation operator, 82 nested if statement, 231–238 nested if-else statement, 242 nested loops, 334–341 new key word, 159 newline character, 117–119, 345 nextLine method, 351–354 no-arg constructors, 182, 644 nodes, scene graph, 1007–1008 nouns, 197–202 null references, 433–436 null statement, 222 NumberFormatException class, 711–712, 718–719, 723 numbers formatting, 270–275 left-justified, 136 padding, with leading zeros, 134–135 right-justified, 136 with comma separators, 133–134 O Object class, 666–668 equals method, 667–668 toString method, 667–668 object-oriented design, 196–204, 453–457 class collaboration, 453–457 finding the classes, 196–204 problem domain, 197–202 responsibilities, identifying, 202–204 object-oriented programming (OOP), 41–45 attributes, 41 component reusability, 42 data hiding, 41–42 encapsulation, 41 inheritance, 44–45 See inheritance methods, 41 ObjectOutputStream class, 747 objects, 41, 43–44 as arguments, 398–411 copy, 420–423 defined, 41 everyday example of, 43 returning from methods, 411–414 serialization, 746–750 subparts, 1172 octal numbers, converting to, 610–611 off-by-one error, 479 one to many relationship, 1133 OOP See object-oriented programming (OOP) operands, 31, 33 operating system, 27 operators, 31, 33 AND, 1115–1116 − (subtraction operator), 82, 83 −− (decrement operator), 301–304 −= (combined assignment), 91–92 ! (logical NOT operator), 244, 249 != (not equal to operator), 218, 219 % (modulus operator), 82, 83 %= (combined assignment), 91–92 && (logical AND operator), 244, 245–247 () (parentheses), 57, 86 * (multiplication operator), 33, 82, 83 *= (combined assignment), 91–92 , (comma separators), 133–134 / (division operator), 82, 83 /* */ (comment symbols), 106–107 /** */ (comment symbols), 107–108 // (comment symbol), 54, 57, 105 /= (combined assignment), 91–92 ; (semicolon), 33, 56–57, 222 ;create=true attribute, 1114 \ (backslash), 62 \\ (backslash escape sequence), 64 \' (single quote escape sequence), 64 \" (double quote escape sequence), 64 \b (backspace escape sequence), 64 \n (newline escape sequence), 62–64 \r (return escape sequence), 64 \t (tab escape sequence), 63, 64 {(opening braces), 55–57 ||(OR logical operator), 244, 247–248 } (closing braces), 55–57 ' (single quotation marks), 77–78 " " (double quotation marks), 57, 68 + (addition operator), 82, 84 + (string concatenation operator), 67, 414, 587 ++ (increment operator), 301–304 += (combined assignment), 91–92 < (less than operator), 217, 218, 1110 (greater than), 217, 218, 1110 Z19_GADD6041_05_GE_IDX.indd Page 1221 31/07/14 7:04 PM user /203/PH01468_GE/9781292076041_GADDIS/GADDIS_STARTING_OUT_WITH_JAVA_EARLY_OBJECTS5 www.downloadslide.net >= (greater than or equal to operator), 217, 218, 1110 arithmetic, 82–90 associativity, 85–86, 249–250 binary, 82 cast, 93–95 combined assignment, 91–92 compound, 91 conditional, 259–260 instanceof, 671–672 LIKE, 1114–1115 logical, 244–251 mixed, in expressions, 95–96 negation, 82 OR, 1115–1116 precedence, 85–86, 249–250 relational, 217–219 ternary, 82 unary, 82 OR operator (SQL), 1115–1116 output devices, 24, 27 overhead, 1065 overloaded methods, 386–391 constructors, 391–397 overloading, methods overriding vs., 651–653 overriding methods, 646–654 overloading vs., 651–653 preventing, 654 P package access, 659–660 packages, 195–196 java.applet, 196, 992 java.awt, 196 java.awt.event, 786, 827, 893, 976, 984 java.io, 196, 705, 741, 746, 897 java.lang, 196, 666, 705 java.net, 196, 995 java.security, 196 java.sql, 196, 1100 java.swing, 196 java.text, 196 java.util, 196, 712 javafx.scene.image, 1048 javax.awt, 763, 797 javax.swing, 763, 764, 776, 797, 866, 881, 887, 896, 900, 943, 987 javax.swing.event, 866, 914 padding numbers, with leading zeros, 134–135 Panel class, 951 panel component, 781 See also JPanel class parameter variable, 157–158, 160–161, 171–173, 194 UML, in, 169–170 parse methods, 609–610 Pascal programming languages, 29 pass by value, 173 password-protected database, connecting, 1095 Payroll class, 227–230 peer classes, 763 percentages, calculating, 87–79 Perl programming languages, 29 PHP programming languages, 29 pixels, 776 plug-in, browser, 951 polymorphism, 668–672 Index and dynamic binding, 669–670 and exceptions, 712 and interfaces, 685–690 portability, 34–35 postfix mode, 303–304 precedence, operator, 85–86 precision, 130, 131–132 preferred size, 906 prefix mode, 303–304 primary keys, 1098, 1111, 1133 priming read, 313 primitive data type, 71–81 primitive-type variables, 99 print method, 59–64 printf method, 126–129 println method, 56, 59–64 PrintWriter class print method, 345 println method, 344–345 private access specifier, 156, 280–281, 660 private methods, 43 problem domain, 197–202 procedural programming, 41 procedure, 41 programmer-defined names, 31, 32, 69–70 programming languages, 28–31 BASIC, 29 C, 29 C#, 29 C++, 29 COBOL, 29 elements, 31–33 FORTRAN, 29 Java See Java programming language JavaScript, 29 Pascal, 29 Perl, 29 PHP, 29 Python, 29 Ruby, 29 Visual Basic, 29 programming process, 38–40 programming style, 109–111, 221–222, 309–310 protected access specifier, 654–660 pseudocode, 39 public access specifier, 54, 155, 157, 660 public methods, 43 punctuation, 31, 33 Python programming languages, 29 Q queries, 1091 quotation marks, double (“), 57, 68 quotation marks, single (‘), 77 – 78 R radio button component, 762, 819–825 See also JRadioButton class RadioButton component, JavaFX GUI, 1006, 1008, 1033–1041 events, responding, 1038–1041 isSelected method, 1035 selection of, 1035–1036 Text property, 1033 ragged arrays, 542–543 raised bevel border, 833 1221 Z19_GADD6041_05_GE_IDX.indd Page 1222 31/07/14 7:04 PM user /203/PH01468_GE/9781292076041_GADDIS/GADDIS_STARTING_OUT_WITH_JAVA_EARLY_OBJECTS5 www.downloadslide.net 1222 Index RAM See random-access memory (RAM) random access files, 740–746 sequential files access vs., 741 Random class, 283–285 nextDouble method, 284 nextFloat method, 284 nextInt method, 284 nextLong method, 284 random numbers, 283–285 random-access memory (RAM), 26, 33 RandomAccessFile class, 741–746 constructor, 741 files pointer, 743–746 readByte method, 743 readInt method, 743 seek method, 721 writeChar method, 742 ranges, checking, 250–251 ranking, data type, 93 raw binary format, 735 read, priming, 313 read-only text field, 863–864 REAL data type (SQL), 1097 realization relationship, 684–685 recursion, 1061–1082 base case, 1065 binary search algorithm, 1075–1078 concentric circles, drawing, 1070–1072 depth of, 1063 direct, 1068 factorial algorithm, 1065–1068 Fibonacci series, 1072–1073 greatest common divisor, finding, 1074–1075 indirect, 1068 introduction, 1061–1064 problem solving with, 1064–1068 recursive case, 1065 summing array elements, 1068–1070 Towers of Hanoi, 1078–1082 reference, null, 433–436 reference copy, 421 reference variables, 99, 159 arrays, 490–491 this, 436–438 uninitialized, 181 referential integrity, 1132 regular expression, 607 relational data, 1131–1152 joining data from multiple tables, 1133–1134 order entry system, 1135–1152 relational operators, 217–219, 1110 >= (greater than or equal to), 217, 218, 1110 > (greater than), 217, 218, 1110

Ngày đăng: 26/04/2019, 11:23

Từ khóa liên quan

Mục lục

  • Starting Out With Java Early OBjects 5th Global Edtiion by Gaddis_1

    • Cover

    • Title

    • Copyright

    • Contents

    • Preface

    • Chapter 1 Introduction to Computers and Java

      • 1.1 Introduction

      • 1.2 Why Program?

      • 1.3 Computer Systems: Hardware and Software

      • 1.4 Programming Languages

      • 1.5 What Is a Program Made of?

      • 1.6 The Programming Process

      • 1.7 Object-Oriented Programming

      • Review Questions and Exercises

      • Programming Challenge

      • Chapter 2 Java Fundamentals

        • 2.1 The Parts of a Java Program

        • 2.2 The System.out.print and System.out.print ln Methods, and the Java API

        • 2.3 Variables and Literals

        • 2.4 Primitive Data Types

        • 2.5 Arithmetic Operators

        • 2.6 Combined Assignment Operators

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

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

Tài liệu liên quan