SEARCH
You are in browse mode. You must login to use MEMORY

   Log in to start

level: Chapter 6 - Arrays

Questions and Answers List

level questions: Chapter 6 - Arrays

QuestionAnswer
ArrayArrays have (in general and in Java) fixed lengths: They contain – once created – a fixed number of data elements. Variables that manage arrays are reference variables (pointer variables) in Java: They contain the starting address of the memory area in which the individual array elements are stored one after the other. Those are accessed by specifying the element number (indexing):
How to create an array?via Initialization: int a[] = new int [20] via assignment: int b; b = new int[] {0,8,15, 47, 11};
RiddleRIDDLE EXTENSIONS: 1. EXPAND PROMPT TO »NUMBER i OF n:«. 2. PRINT THE ARRAY IN REVERSE ORDER 3. PRINT THE ARRAY IN BOTH ORDERS (3-COLUMN LAYOUT: 1ST COLUMN: PLACE NUMBER (INDEX) i, 2ND COLUMN: iTH VALUE IN INPUT ORDER, 3RD COLUMN: iTH VALUE IN REVERSE ORDER) 4. CHANGE ARRAY TO A FLOATING POINT ARRAY WITH OUTPUT OF DESCRIPTIVE STATISTICS (SUM OF VALUES, MEAN, VARIANCE...)