Skip to content

KotaYamini/JavaArrays

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

95 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JavaArrays

Fixed number of values of same data type. Syntax: datatype nameOfVariable[] = new dataType[size];

  1. int[] arr = new int[size];
  2. int []arr = new int[size];
  3. int arr[] = new int[size];

Indexing & Properties:

  1. Indexing :

int arr[] = new int[5]; => Indexes are always start from 0; => ith index = arr[i]

Access first and last elements: arr[0] & arr[n-1]

Note: There are not heterogeneous arrays in java.

  1. Properties:

  1. int arr[] = new int[5]; Ex: System.out.print(arr.length); //5

  2. By default all the elements are initialized with 0;

Ex:

  1. for(int i=0; i< arr.length; i++){ System.out.println(arr[i]); } output: 0 0 0 0 0

  2. float arr[] = new float[5]; for(float i=0; i< arr.length; i++){ System.out.println(arr[i]); } output: 1.0 2.0 3.0 4.0 5.0

  3. double arr[] = new double[5]; for(double i=0; i< arr.length; i++){ System.out.println(arr[i]); } output: 1.0 2.0 3.0 4.0 5.0

Note: Java cannot have negative indexing as it will throw error.

sumofStatic1DArray image

Sum of 1D Array elements with user input image

Min And Max in 1D Array image

Frequency Of X in 1D Array image

Reverse A 1D array image

Product Of Elements In 1D Array image

Copy The 1D Array into Output Array image

EvenAndOddElementsInOneDArray image

TemperatureDifferenceInOneDArray image

AverageRainFallInOneDArray image

CountOfElementsGreaterThanB image

PositionOfElementB image

InsertThatElementin1DArray image

RemoveThatElementin1DArray image

ReverseArrayToGetNewArray image

SwappingOfTwoElements In One Dimension Array image

ReverseAPartOfArray In One Dimension Array image

FrequencyOfElements In One Dimension Array image

OddNegativeIncrement In Dynamic Array image

Max Occurrence of character in a String image

Sum of [Max-Min] of Each 1D Array from a 2D Array image

Max Product Pair in 1D Array image

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages