Core Java Training in Training PowerPoint PPT Presentation

presentation player overlay
About This Presentation
Transcript and Presenter's Notes

Title: Core Java Training in Training


1
CORE Java Training in Chennai
By Accordittraining.com
2
Array of java
  • Topics
  • 1. What is Array?
  • 2. Array variables
  • 3. Pass by reference
  • 4. Multidimensional Arrays

3
What is an array?
  • An array is a very common type of data structure
    wherein all elements must be of the same data
    type.
  • Once defined, the size of an array is fixed and
    cannot increase to accommodate more elements.
  • The first element of an array starts with index
    zero.
  • Ex
  • x00 x11 x22 x33 x44
    x55

4
ARRAY VARIABLES
  • Using an array in your program is a 3 step
    process -
  • 1) Declaring your Array
  • 2) Constructing your Array
  • 3) Initialize your Array
  • 1) Declaring your Array
  • Syntax
  • ltelementTypegt ltarrayNamegt

5
Contd.
  • 2) Constructing an Array
  • Syntax
  • arrayname new dataType
  • 3) Initialize an Array
  • Syntax
  • intArray01 // Assigns an integer value 1 to
    the first element 0 of the array
  • intArray12 // Assigns an integer value 2 to
    the second element 1 of the array

6
PASS BY REFERENCE
  • Arrays are passed to functions by reference, or
    as a pointer to the original. This means anything
    you do to the Array inside the function affects
    the original.

7
MULTI DIMENSIONAL ARRAY
  • Multidimensional arrays are actually arrays of
    arrays.
  • To declare a multidimensional array variable,
    specify each additional index using another set
    of square brackets.
  • Ex int twoD new int45
  • When you allocate memory for a multidimensional
    array, you need only specify the memory for the
    first (leftmost) dimension.
  • You can allocate the remaining dimensions
    separately.

8
Contact us
www.accordittraining.com
EMAILenquiry_at_accordittraining.com
CALL US (91) 994 028 9059
Write a Comment
User Comments (0)
About PowerShow.com