Murach's Java SE 6
Introduction to Java programming

This chapter shows you how to write a simple but complete Java application that uses the console for input and output. This introduces you to the Java basics that you'll use every day, including primitive data types, variables, strings, the Scanner class, if statements, and while loops. To see how well this book works, you can download this chapter tutorial for free.

Chapter 2 Introduction to Java programming
Basic coding skills 46
How to code statements 46
How to code comments 46
How to create identifiers 48
How to declare a class 50
How to declare a main method 52
How to work with numeric variables 54
How to declare and initialize variables 54
How to code assignment statements 56
How to code arithmetic expressions 56
How to work with string variables 58
How to create a String object 58
How to join and append strings 58
How to include special characters in strings 60
How to use Java classes, objects, and methods 62
How to import Java classes 62
How to create objects and call methods 64
How to use the API documentation to research Java classes 66
How to use the console for input and output 68
How to use the System.out object to print output to the console 68
How to use the Scanner class to read input from the console 70
Examples that get input from the console 72
How to code simple control statements 74
How to compare numeric variables 74
How to compare string variables 74
How to code if/else statements 76
How to code while statements 78
Two illustrative applications 80
The Invoice application 80
The Test Score application 82
How to test and debug an application 84
How to test an application 84
How to debug an application 84




Murach's Java SE 6

Learn more about this book

Add this book to your cart

Download this chapter



Our Ironclad Guarantee

First, try our books for 90 days. Then, if you aren't completely convinced that our books are the best ones you've ever used, you can return them for a full refund...no questions asked.