



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Fall 2001 CS 357 Class Notes (^) Page 2
Fall 2001 CS 357 Class Notes Page 3
Two’s complement? See http://www.duke.edu/~twf/cps104/twoscomp.html
Fall 2001 CS 357 Class Notes (^) Page 4
Fall 2001 CS 357 Class Notes (^) Page 5
Fall 2001 CS 357 Class Notes Page 6
Fall 2001 CS 357 Class Notes (^) Page 10
Fall 2001 CS 357 Class Notes (^) Page 11
Fall 2001 CS 357 Class Notes Page 12
< type >[] < name > [={< val0 >,< val1 >,…,< valN-1 >}];
Fall 2001 CS 357 Class Notes (^) Page 13
Code Blocks
Describe what happens when each of the code blocks to the right are inserted into the code below.
class foo { public static void main(String[ ] args) { // Insert block here System.out.println (x[0]); } }
Fall 2001 CS 357 Class Notes (^) Page 14
public class ArrayOfArraysDemo { public static void main(String[] args) { String[ ][ ] cartoons = { { "Flintstones", "Fred", "Wilma", "Pebbles", "Dino" }, { "Jetsons", "George", "Jane", "Elroy", "Judy", "Rosie", "Astro" }, { “S.D. Gang", "Scooby Doo", "Shaggy", "Velma", "Fred", "Daphne" } }; for (int i = 0; i < cartoons.length; i++) { System.out.print(cartoons[i][0] + ": "); for (int j = 1; j < cartoons[i].length; j++) { System.out.print(cartoons[i][j] + " "); } System.out.println(); } } }
Fall 2001 CS 357 Class Notes Page 15