Jump to content
  • 0

Value for Int[]


Question

Posted

I would like to know how I get the value of a list, for example I configured a list like this 100;100;100;30;30, I just want to retrieve the values 100 and get the value of 3 as would be done by an int[ ] ?

2 answers to this question

Recommended Posts

  • 0
Posted (edited)

int[] a = new int[]{10,20,30,40,50};

int b = i[0]; // b = 10

int c = i[2]; // c = 30

 

Edited by BruT
  • 0
Posted

Your question is a bit unclear, if you're looking for a value at a specific index in the list, you may use List.get(index) method. It's similar to what you would use in an array, for example if you want the 2nd element of an array you would use: array[1], if you want the same element from a list you would use: List.get(1). Remember that for lists, like arrays, index starts from 0 and not from 1.

 

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock