CST 3170 Home Page The Next Page
Middlesex Logo

Lab 1: Hello World and 2D Arrays

  1. Open up Eclipse.
  2. Make a new java hello world program.
  3. Now we're going to play with arrays.
  4. First, make a 1 dimensional array.
  5. Fill it up via definition (int []arr = {3,4,2};)
  6. Print it out.
  7. Now, make a 1 dimensional array with 10 items.
  8. Fill it up with a for loop.
  9. Can you do the first 10 odd numbers?
  10. Print it out.
  11. Now try a 2D array of integers. Let's make it 2x100;
  12. Fill it up with a loop.
  13. Put the init in a function, and call it from the main.
  14. Make a print function too, and call it.
  15. Make a function that sorts based on the first number.
  16. Print the result.
  17. Make a function that sorts based on the second number.
  18. Print it.