Eager to Code, Enjoy to Debug ~ Embark into Each Stage with Your Heart

Archive for October 10th, 2008

Chapter 5: Control Statements Part II (Exercise 5.11)

Posted by: Chyne on: October 10, 2008

/* Exercise 5.11
* 1. Calculates the product of the odd integers from 1 to 15.
*/
package Exercises;
public class ProductOddIntegers {
public static void main(String[] args) {
// initialization phase
int count;
int product = 1;
// loop from 1 to 15
for (count = 1; count <= 15; count += 2) {
// calculate the product
product = count * product;
} // [...]

Chapter 5: Control Statements Part II (Exercise 5.10)

Posted by: Chyne on: October 10, 2008

/* Exercise 5.10
* 1. Finds the smallest of several integers.
* 2. First value read specifies the number of values to input from the user.
*/

package Exercises;
import java.util.Scanner;

public class SmallestOfIntegers {
public static void main(String[] args) {
// initialization phase
int counter = 1;
int count = 1;
int num;
int num1;
int smallest = 0;
// create Scanner to obtain input from [...]


Friday’s Java Snack


In Java, "thread" means:

  • An instance of class java.lang.Thread
  • A thread of execution


An instance of Thread is just an object that has variables and methods, and lives and dies on the heap.
 
A thread of execution is an individual process that has its own call stack (one thread per call stack).

 

October 2008
M T W T F S S
« Sep   Nov »
 12345
6789101112
13141516171819
20212223242526
2728293031  

Archives


StatCounter

free hit counters