some code samples, various examples of simple modeling ideas and some minor algorithms.

TriangleOne.java 400B

12345678910111213141516171819202122
  1. class TriangleOne
  2. {
  3. // Print a bottom-left right-angled triangle of stars, of size SIZE
  4. static final int SIZE=5;
  5. public void display()
  6. {
  7. this.display(SIZE);
  8. }
  9. public void display(int size)
  10. {
  11. for(int i=0;i<size;i++)
  12. {
  13. for(int j=0;j<=i;j++)
  14. System.out.print("*");
  15. System.out.println();
  16. }
  17. }
  18. }