Sign In | Subscribe
Start learning today, and be successful in your academic & professional career. Start Today!
Loading video...
This is a quick preview of the lesson. For full access, please Log In or Sign up.
For more information, please see full course syllabus of Introduction to Java
  • Discussion

  • Study Guides

  • Download Lecture Slides

  • Table of Contents

  • Related Services

Bookmark and Share
Lecture Comments (17)

0 answers

Post by Jim Tang on December 22, 2015

for my question below, i found "static" means shared by the class as a whole, rather than by individual objects of that class. i get how that would be pertinent to stuff with numOfMembers, where this data field is part of the class as a whole, and of static methods that involve numOfMembers.

but how would that be relevant to public static double findAverage(int[] nums)? it doesn't really seem like we are creating objects, so what is the meaning of static in the findAverage case?

0 answers

Post by Jim Tang on December 21, 2015

hey tom!

what does the static mean when it's used in a method?

ex. public static double findAverage(int[] nums)

1 answer

Last reply by: Professor Quayle
Sun May 18, 2014 10:22 PM

Post by Lucas Davis on May 10, 2014

How could I create an array with letters, such as roman numerals, and translate them into an int value?

1 answer

Last reply by: Professor Quayle
Sat Sep 7, 2013 10:56 PM

Post by Joyce Choi on August 30, 2013

In the example for passing an array to a method could you have just created sum as a double in the first place instead of casting it as a double later on?

10 answers

Last reply by: Professor Quayle
Wed Jul 10, 2013 12:56 PM

Post by M C on July 5, 2013

You do not present nor demo code for a two-dimensional array. Not good.

Arrays

  • An array is a group of memory locations accessed through one variable name
  • The [] symbols are used to indicate an array
  • Values in an array can be changed at any time
  • The size of an array cannot be changed once the array is created
  • Arrays can be passed to methods and returned from methods
  • An array can be more than one dimension; use one set of [] for each dimension

Arrays

Lecture Slides are screen-captured images of important points in the lecture. Students can download and print out these lecture slide images to do practice problems as well as take notes while watching the lecture.

  • Intro 0:00
  • Roadmap 0:14
  • Declaring and Creating an Array 0:49
    • Array Defined
    • 1st Way to Declare and Create and Array
    • 2nd Way to Declare and Create and Array
  • Referring to Elements in an Array 5:12
    • Integer Expression
    • Code Example: Declaring and Creating Arrays
  • Referring to Elements in an Array 9:12
    • Example
    • Code Example: Looping Through an Array of Ints
  • Referring to Elements in an Array 15:35
    • Enhanced for Loop
    • Code Example: Looping Through an Array of Strings With an Enhanced for Loop
  • Referring to Elements in an Array 19:25
    • ArrayIndexOutOfBoundsException
    • Code Example: Array Index Out of Bounds Exception
  • Resizing Arrays 23:05
    • Example
    • Code Example: Resizing Arrays
  • Copying Arrays 28:13
  • Passing an Array to a Method 30:09
    • Example
    • When Calling This Method: Pass in an Array
    • Code Example: Passing an Array to a Method
  • Returning an Array From a Method 36:02
    • Create a Method
    • Calling This Method
    • Code Example: Returning an Array to a Method
  • Two-Dimensional Arrays 42:23
    • Length Method
    • Number of Columns
  • Summary 45:00