Programming in Java Workshop



Java Workshop

Day 2

Introduction

Today’s goal is to introduce you to some basic java concepts. In particular, we’ll talk about loops, if/then statements, methods, utilizing the Convert class.

Loops

There are several kinds of loops in java—the for loop, a while loop, and a do-while loop. We’ll focus on the for loop. More information about the others can be found in Appendix 1. The basic format for a for loop is

for (initial counter value; logical statement; increment)

{

//put code here

}

Example:

for (int counter=1; counter ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download