Every hour of this book ends with a Java programming project you can undertake to enhance your knowledge of the subject matter while it percolates in your brain.
You can’t do any of that Java programming if you lack a Java programming tool on your computer.
If you have a programming tool such as NetBeans or the JDK, you can use it to develop the tutorial programs in the next 23 hours. However, you already should have some familiarity with how to use the tool. Learning Java and a complex development tool at the same time can be daunting.
If you don’t have a Java development tool, you ought to consider using NetBeans 7, which is freely available from Oracle’s website: www.netbeans.org.
To find out how to download and install NetBeans, read Appendix A, “Using the NetBeans Integrated Development Environment.”
During this hour, you were introduced to the concept of programming a computer—giving it a set of instructions that tell it what to do. You also might have downloaded and installed a Java development tool that you will use as you write sample programs throughout the book.
If you are still confused about programs, programming languages, or Java in general, don’t sweat. Everything will begin to make sense in the next hour, “Writing Your First Program,” which gingerly steps through the process of creating a Java program.
Q. BASIC? C++? Smalltalk? Java? What are the names of these languages supposed to mean?
A. BASIC gets its name from an acronym that describes what it is: Beginner’s All Symbolic Instruction Code. C++ is a programming language that was created to be an improvement on the C language, which itself was an improvement of the B programming language. Smalltalk is an innovative object-oriented language developed in the 1970s that had numerous ideas adopted by Java.
Java goes against the tradition of naming a language with an acronym or other meaningful term. It’s just the name that Java’s developers liked the best, beating out WebRunner, Silk, Ruby, and others. When I create my own programming language, it will be named Salsa. Everybody loves salsa.
Q. Why are interpreted languages slower than compiled ones?
A. They’re slower for the same reason that a person interpreting a live speech in a foreign language is slower than a translator interpreting a printed speech. The live interpreter has to think about each statement that’s being made as it happens, while the other interpreter can work on the speech as a whole and take shortcuts to speed up the process. Compiled languages can be much faster than interpreted languages because they do things to make the program run more efficiently.
Q. Do you answer questions only about Java?
A. Not at all. Ask me anything.
Q. Okay, what is the lowest score ever given on Dancing with the Stars?
A. The worst dance by a celebrity contestant on the hit ABC show was performed by the rapper Master P during the second season in 2006. His Paso Doble with professional dancer Ashly DelGrosso scored a lowest-ever 8. Judges Len Goodman and Bruno Tonioli scored it a 2 and judge Carrie Ann Inaba a 4.
Tonioli’s take: “It was a nightmare. ... It looked like a child on the mall lost looking for his mother.”
Goodman: “I know viewers think they’re being kind by bringing you back. They’re not. They’re being cruel—to Ashly, to the judges.”
Inaba: “I actually thought that that was your best dancing.”
Master P trained only 20 hours for the show, compared to 130 for the other contestants at that point in the season. He also refused to wear dancing shoes and performed in basketball sneakers. The dance was his last before being voted off.
The dance can be seen on YouTube, where one commenter writes, “Thumbs up if you’re watching this just to see the 2 paddle.”
Test your knowledge of the material covered in this hour by answering the following questions.
1. Which of the following is not a reason that people think computer programming is painfully difficult?
A. Programmers spread that rumor to improve their employment prospects.
B. Jargon and acronyms are all over the place.
C. People who find programming too difficult are eligible for a government bailout.
2. What kind of tool runs a computer program by figuring out one line at a time?
A. A slow tool
B. An interpreter
C. A compiler
3. Why did James Gosling hole up in his office and create Java?
A. He was unhappy with the language he was using on a project.
B. His rock band wasn’t getting any gigs.
C. When you can’t visit YouTube at work, the Internet is pretty dull.
1. C. Computer book authors didn’t get a bailout either.
2. B. Compilers figure out the instructions beforehand so that the program can run faster.
3. A. He was frustrated with C++. Back in 1991 when Gosling created Java, people thought that YouTube was the place that held YouToothpaste.
If you’d like to better introduce yourself to the subjects of Java and computer programming, do the following activities:
• Visit Oracle’s Java site at www.oracle.com/technetwork/topics/newtojava, and read some of the Get Started with Java Technology pages.
• Using English sentences instead of a programming language, write a set of instructions to add 10 to a number selected by a user, and then multiply the result by 5. Break the instructions into as many short one-sentence lines as you can.
To see solutions to the activities at the end of each hour, visit the book’s website at www.java24hours.com.
3.23.101.1