Java Tutorial #10 — Loop logic / intro

Topics Discussed: While loops, do_while loops, counter controlled loops, loop syntax, loop scoping Source Code For Lesson 10: import java.util.Scanner; class Jtutorial1 { public static void main(String args[]){ Scanner input = new Scanner(System.in); int i=0;//initialize a new variable for use as a counter while(i < 10){//While the variable is less than 10 System.out.println(i);//Print the current... » read more

Java Tutorial #13 — More loops! Sentinel and break;

Topics Discussed: More loop practice, sentinel / dummy record loops, breaking out of loops Source Code for Lesson 13: import java.util.Scanner; class Jtutorial1 { public static void main(String args[]){ Scanner input = new Scanner(System.in); int i=0, j=0; //Dummy record / sentinel controlled loop. while (i < 100){ j = i*5; System.out.println("The value of i is:"... » read more