O'Reilly logo

Sams Teach Yourself Java™ in 24 Hours, Sixth Edition by Rogers Cadenhead

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Hour 2. Writing Your First Program

What You’ll Learn in This Hour:

• Entering a program into a text editor

• Naming a Java program with the class statement

• Organizing a program with bracket marks

• Storing information in a variable

• Displaying the information stored in a variable

• Saving, compiling, and running a program

• Fixing errors

As you learned during Hour 1, “Becoming a Programmer,” a computer program is a set of instructions that tells a computer what to do. These instructions are given to a computer using a programming language.

During this hour, you create your first Java program by entering it into a text editor. When that’s done, you save the program, compile it, and test it out.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required