• 1
  • 2
  • 3
  • 4
  • 5

Java programming

 Element Of Programming


 Our goal in this chapter is to convince you that writing a computer program is easier than writing a piece of text such as a paragraph or an essay. Writing prose is difficult: we spend many years in school to learn how to do it. By contrast, just a few building blocks suffice to take us into a world where we can harness the computer to help us solve all sorts of fascinating problems that would be otherwise unapproachable. In this chapter, we take you through these building blocks, get you started on programming in Java, and study a variety of interesting programs.


  • 1.1 Elements of Programming instructs you on how to create, compile, and execute a Java program on your system.
  • 1.2 Built-in Types of Data describes Java's built-in data types for manipulating strings, integers, real numbers, and booleans.
  • 1.3 Conditionals and Loops introduces Java structures for control flow, including if-else statements, while loops, and for loops.
  • 1.4 Arrays considers a data structure known as the array for organizing large quantities of data.
  • 1.5 Input and Output extends the set of input and output abstractions (from command-line input and standard output) to include standard input, standard drawing, and standard audio.
  • 1.6 Random Web Surfer presents a case study that models the behavior of a web surfer using a Markov chain.

Java programs in this chapter.

 Below is a list of Java programs in this chapter. Click on the program name to access the Java code; click on the reference number for a brief description; read the textbook for a full discussion.