COMP 202 Lecture 16: COMP 202 - Lecture 16 - Oct 12, 2016

18 views2 pages
jc123 and 40170 others unlocked
COMP 202 Full Course Notes
100
COMP 202 Full Course Notes
Verified Note
100 documents

Document Summary

How many times does the word hello get printed? for(int i=0; i<10; i++){ for(int j=0; j<10; j+=2){ //increments j by 2. The contents of the outer loop happens 10 times, so bye gets printed 10 times. The contents of the inner loop happens 5 times. However, the whole loop happens 10 times, so hello gets printed 5 x 10 = 50 times. To create an array: passstring[] names = new string[15]; int[] numbers = {1,2,3,4,5}; boolean[] values; //just declaring, not initializing. The size or length of an array is the number of elements that it contains. The first element in an array is at index 0. Array indices are written inside square brackets [ ]. Array example int[] a = new int[5]; for(int i=0; i

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents

Related Questions