Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 89 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
89
Dung lượng
2,44 MB
Nội dung
[...]... JOptionPane Class 11 1 xii Java All-in-One Desk Reference For Dummies Chapter 3: Working with Numbers and Expressions 11 3 Working with Arithmetic Operators 11 3 Dividing Integers 11 6 Combining Operators 11 8 Using the Unary Plus and Minus Operators .11 9 Using Increment and Decrement Operators .12 0 Using the Assignment Operator 12 2 Using Compound... 811 Creating Collidable Balls . 812 Playing Games 814 Index 8 21 xxvi Java All-in-One Desk Reference For Dummies Introduction W elcome to Java All-in-One Desk Reference For Dummies, the one Java book that’s designed to replace an entire shelf full of the dull and tedious Java books you’d otherwise have to buy This book contains all the basic and not-so-basic information... 6 Book I: Java Basics .7 Chapter 1: Welcome to Java 9 What Is Java, and Why Is It So Great? 9 Platform independence .10 Object orientation 11 The Java API 12 The Internet 12 Comparing Java to Other Languages 13 Important Features of the Java Language 15 Type checking .15 Automatic memory... the user decide 16 6 Using the continue Statement 16 7 do-while Loops .16 8 Validating Input from the User 17 0 Table of Contents xiii The Famous for Loop 17 3 The formal format of the for loop 17 3 Scoping out the counter variable .17 6 Counting even numbers 17 7 Counting backwards 17 7 for loops without bodies 17 8 Ganging up your... 14 1 Using Simple Boolean Expressions 14 1 Using If Statements 14 4 Simple if statements 14 4 if-else statements 14 6 Nested if statements 14 7 else-if statements 15 1 Mr Spock’s Favorite Operators (The Logical Ones, of Course) 15 3 Using the ! operator 15 3 Using the & and && operators 15 4 Using the | and || operators 15 5 Using... path 24 x Java All-in-One Desk Reference For Dummies Using Java s Command-Line Tools .25 Compiling a program 26 Compiling more than one file 26 Using Java compiler options .27 Running a Java program 29 Using the javap command 31 Other Java command-line tools 32 Using Java Documentation 32 JS2E API Docs 33 Java Language Specification... 17 9 Omitting expressions 18 1 Breaking and continuing your for loops 18 1 Nesting Your Loops 18 2 A simple nested for loop 18 2 A guessing game 18 3 Chapter 6: Pulling a Switcheroo 18 7 else-if Monstrosities 18 7 A Better Version of the Voter Machine Error Decoder Program 18 9 Using the switch Statement 19 0 A... Assignment Operators 12 3 Using the Math Class 12 4 Constants of the Math class 12 5 Mathematical functions .12 6 Creating random numbers 12 9 Rounding functions 13 1 Formatting Numbers 13 3 Weird Things about Java Math 13 6 Integer overflow 13 6 Floating-point weirdness 13 7 Dividing by zero 13 8 Chapter 4: Making Choices... 15 6 Combining logical operators 15 7 Using the Conditional Operator 15 9 Comparing Strings 15 9 Chapter 5: Going Around in Circles (Or, Using Loops) 16 1 Your Basic while Loop 16 2 The while statement 16 2 A counting loop 16 2 Breaking Out of a Loop 16 3 Looping Forever 16 4 Letting the user decide when to quit .16 5... 10 1 Type casting 10 2 Understanding Scope 10 2 Shadowing Variables 10 4 Printing Data with System.out 10 5 Standard input and output streams 10 5 Using System.out and System.err 10 7 Getting Input with the Scanner Class 10 7 Importing the Scanner class .10 8 Declaring and creating a Scanner object .10 9 Getting input .10 9 Getting . alt="" 01_ 58961X ffirs.qxd 3/29/05 3:24 PM Page iv by Doug Lowe Java ™ ALL-IN-ONE DESK REFERENCE FOR DUMmIES ‰ 01_ 58961X ffirs.qxd 3/29/05 3:24 PM Page i Java ™ All-in-One Desk Reference For Dummies ® Published. more than 30 For Dummies books, such as Networking For Dummies (7th Edition), Networking For Dummies All-in-One Desk Reference, PowerPoint 2003 For Dummies, and Internet Explorer 6 For Dummies. He. orientation 11 The Java API 12 The Internet 12 Comparing Java to Other Languages 13 Important Features of the Java Language 15 Type checking 15 Automatic memory management 17 Exception handling 17 On