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

Chapter 5: Control Statements Part II (Exercise 5.14 c)

Posted by: Chyne on: October 11, 2008

/*
* Exercise 5.14 (c)
*/

package Exercises;
public class Asterisks_c {

public static void main(String[] args) {
// initialization phase (row and column)
int i;
int j;

// loop for row
for (i = 10; i >= 1; i–) {
System.out.println();

// loop for spaces
for (int k = 10; k > i; k–) {
System.out.print(‘ ‘);
} // end for loop for spaces

// loop for column
for (j = 1; j <= i; j++) {
System.out.print(‘*’);
} // end for loop for column
} // end for loop for row
} // end main
} // end class

Leave a Reply

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