CSE 205 Lecture Notes - Lecture 1: Subsequence, Empty String, Exception Handling

76 views9 pages

Document Summary

In java, an array is a much better choice for storing a sequence of values of the same type. The following are ways to initialize an array- double[] values = new double[10]; double[] values = { 32, 54, 67. 5, 29, 35 }; Here, the type double stores floating values in array which is of length 0 to 9 and stores 10 elements. We can access the element stored in ith index through values[i] = 0; The index that is i must be greater than or equal to 0 and less than length of an array. Arrays suffer from a significant limitation: their length is fixed. If you start out with an array of. 10 elements and later decide that you need to add additional elements, then you need to make a new array and copy all elements of the existing array into the new array.

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