Beginning Programming with Java For Dummies 5th Edition pdf pdf

Gratis

0
0
555
3 months ago
Preview
Full text

SHOULD BE AWARE THAT INTERNET WEBSITES LISTED IN THIS WORK MAY HAVE CHANGED OR DISAPPEARED BETWEEN WHEN THIS WORK WAS WRITTEN AND WHEN IT IS READ

  If this book refers tomedia such as a CD or DVD that is not included in the version you purchased, you may download this material at http://booksupport.wiley.com . .315Why the computer accidentally pushes past the end of the file .

IF COLUMN-NUMBER IS GREATER

  When you see the word Start on your computer screen, the 01010011 01110100 01100001 01110010 computer stores the word internally as 01110100 . That’s because, in Java, the bytecode gets stored in » files named SomethingOrOther .class .

WHAT IS BYTECODE, ANYWAY?

  You may be tempted to think that a bytecode file is just a cryptogram — substituting zeros and onesfor the letters in words like if and else . The thing you should glean from my mix of text, boxes, .class and arrows is that bytecode (the stuff in a file) contains a complete description of the operations that the computer is to perform .

WRITE ONCE, RUN ANYWHERE

  (Simply click the big Java Download button . You can’t miss it .) TheJava Download button doesn’t work on all computers . .zip .tar.gzfile or a file in Step 4, extract the If you downloaded a contents of this compressed archive.eclipse orIf you have a compressed archive, you see a folder named Eclipse.app when you uncompress it .

THOSE PESKY FILENAME EXTENSIONS

  Then follow the instructions in the In All Versions of Windows bullet . Then follow the instructions in the In All Versions of Windows bullet .

COMPRESSED ARCHIVE FILES

  With plain, old Java 8, you can run all the programs in this book . But if you have Java 9, you can use JShell — a tool for experimenting quickly and easilywith snippets of Java’s code .

EENIE, MEENIE, MINEY MO

  (That’s no misprint . Version 5 .0 comes immediately afterthe 1 .4 versions .)The formal name for version 1 .5 is Java 2 Platform, Standard Edition 5 .0 . (Actually, the original name was the JDK. Later, SunMicrosystems changed it to the SDK. A few years after that, the captains of Java changed it back to the name JDK. This constant naming and renaming drives mecrazy as an author.) Java SE, Java EE, and Java ME • While you wander around, you may notice links labeled Java EE or Java ME. If you know what these are, and you know you need them, by all means, download thesegoodies .

HOW MANY BITS DOES YOUR COMPUTER HAVE?

  (See the figure that accompanies this sidebar.) When a website makes you choose between 32-bit and 64-bit software versions, the main consideration is the word length of your operating system, not the word length ofyour computer’s circuitry . You can run a 32-bit word processor on a 64-bit operating system, but you can’t run a 64-bit word processor on a 32-bit operating system (nomatter what word length your computer’s circuitry has) .

2. You see Version 10 .12 .4 (or something like that) in faint gray text

  In Figure 2-3, the computer has four versions of Java: the 32-bit (i386) versions of Java 6 and Java 7 and the 64-bit (x86_64) versions of Java 6 and Java 7 . Anyway, if your com-puter responds with the number 9 or higher, you can pop open the cham- pagne and look forward to some good times running this book’s examples .

2. Click the Download button

  This other button offered me a copy of Eclipse from one of many servers around the world . (As a result, Explorer .zip displays the contents of the file, which consists of only one folder — a eclipse eclipse folder named .) Drag the folder to a convenient place on your computer’s hard drive .

C: Program Files Windows eclipse

  I avoid making the folder be a subfolder of because from time to time, I’ve had problems dealing with the blank space in Program Files . .tar .tar.gz Downloads If you find a new file or file in your folder, eclipse double-click the file until you see the folder .

1. In Windows, the Start menu may not have an Eclipse icon . In that case, look in

  When Eclipse On a Mac, go to the Spotlight and type Eclipse appears as the top hit on the Spotlight’s list, press Enter . (See Figure 2-10.)The dialog asks where, on your computer’s hard drive, you want to store the code that you will create using Eclipse .

3. Within the

  In the list, each version of Java has a check box . If the checked version isn’t your preferred version (for example,if the checked version isn’t version 9 or higher), you can make some changes .

8. How you do this depends on your operating system . •

  (The first is for Apple’s old version of Java; the second is for Oracle’s new Java version.) You might also find Apple’s old Java version /System/Library/Frameworks/JavaVM.framework/Versions in the /Library/Internet Plug-Ins/ directory, and find Oracle’s Java in the JavaAppletPlugin.plugin/Contents/Home directory . To see the contents of this item, Control-click the item’s icon and then select Show Package Contents from the menu that appears .

10. Eclipse’s Preferences dialog returns to the foreground . The box’s Installed JREs list contains your newly added version of Java

  In the main body of the Preferences dialog, you see a Compiler Compliance Level drop-down list . .zip files and other archive files, see the sidebarFor the complete scoop on entitled “Compressed archive files.” FIGURE 2-18:The Import Projects dialog .

2. Launch Eclipse

  FIGURE 3-2:The Eclipse Workspace Launcher . These settings store things like the version of Java that you’re using, the colors that you prefer forwords in the editor, and the size of the editor area when you drag the area’s edges.

3. The big Eclipse workbench stares at you from your computer screen. (See

  (The Console view shares the lower-right area of Eclipse’s workbench with the Problems view, the Javadoc view, the Declaration view, andpossibly other views. Refer to Figure 3-1.) FIGURE 3-4:One of the ways to run thecode in Project 03-0-Mortgage . If your choice of folder isn’t in the list,select the Other option .

2. From Eclipse’s menu bar, choose File ➪ New ➪ Java Project

  MyFirstProject In Figure 3-7, I type the name . The choice of clicks and keystrokes is up to you .

9. Type a line of code in Eclipse’s Editor. Replace the line

  LISTING 3-1: A Program to Display the Things I Likepublic class MyFirstJavaClass { public static void main(String[] args) {System.out.println("Chocolate, royalties, sleep"); }} Java is case-sensitive, which means that system.out.printLn isn’t the same as System.out.println system.out.printLn , your progrAm won’t . Near the bottom ofthe figure, one of the quick fix options is to change system to System .

WHAT CAN POSSIBLY GO WRONG?

  If you want to force the Console view to appear, choose Window ➪ Show View ➪ Other . c class In Eclipse’s editor, change the lowercase letter in the word to an »C uppercase letter .

1. Then follow the instructions in the first half of Chapter 3

  The main method in a programmain In Listing 4-1, the bulk of the code is the declaration of a method named .main (Just look for the word in the code’s method header.) For now, don’t worry public static void about the other words in the method header — the words , , , String args , and . ThingsILike I chose the name , so the code in Listing 4-1 starts with the words class ThingsILike .class Take another look at Listing  4-1 and notice what happens after the line ThingsILike .

VALID IDENTIFIERS

  There are limits to the kinds of names you can make up. What kinds of names can you make up as part of a Java program?

YOUR FAVORITE THINGS

  (RoboJeeves is an upscale model in the RJ-3000 line of personal robotic life-forms.) Here’s howthe discussion went: JMe: RoboJeeves, tell me the velocity of an object after it’s been falling for three seconds in a vacuum . “The velocity of an object after it’s been falling for three seconds in a vacuum .” There, I told it to you .

1. The computer is waiting for you to type something

  Spell exactly the way I spellIn this example, use the name E L it in Listing 5-1, with a capital , a capital , and no blank space . (In particular, the in ln is a letter, not a digit.) The name comes from the words “print a line .” If you were allowed to PRINTLN write the name in uppercase letters, it would be , with a letter L near the end of the word .

9. When at last you see no error markers, you’re ready to run the program

  If you forget to click inside the Console view, Eclipse may not send your keystrokes to the running Java program . When the computer runs your program, the computer keyboard.substitutes whatever you type on the keyboard in place of the textnextLine() .

GETTING SINGLE WORDS AND ENTIRE LINES OF TEXT

  In plain English, Println this means “The Java compiler can’t interpret the word .” (The message Println stops short of saying, “Don’t type the word , you Dummy!” In any case, if the computer says you’re one of us Dummies, you should take it as a compliment.)Now, there are plenty of reasons why the compiler may not be able to understand Println a word like . println in Listing 5-1,For example, if you change the spelling or capitalization of is undefined for the type PrintStream Eclipse tells you the method .

COMPILE-TIME ERRORS

  println l 1 In the word , change the lowercase letter to a digit . » Break the quoted text between lines as follows: »System.out.println("Chocolate, royalties,sleep"); Open your favorite word processing program (Microsoft Word, Apple Pages, or » whatever) and create a document containing only the text “Chocolate, royalties, sleep” .

ALLOWABLE CHANGES IN SPACING AND INDENTATION

  Someone has to launch Eclipse, look over the code, change the code, test the new code, and distribute the new code to the people who run it . Instead of hard-coding values, you should type values on the keyboard during the run of the program .

Dokumen baru

Aktifitas terbaru

Download (555 Halaman)
Gratis

Tags

Wiley Publishing Beginning Programming For Dummies 976 Beginning Xml 5Th Edition Java For Everyone Late Objects 2Nd Edition Pdf Pdf Html5 Programming With Javascript For Dummies Beginning C 5 0 Databases 2Nd Edition Pdf Pdf Big Data For Dummies 2010Kaiser Pdf Pdf Wiley Publishing C For Dummies 5Th Problem Solving With C 10Th Global Edition Pdf Pdf
Show more