You need to sign in to do that
Don't have an account?

how to write array
hi,all
now I'm developing calculation application.
while I'm developing my application, I wonder how to write array.
I want to use two random numbers by using array, so I write a code like this below.
public Integer getRandomNumber1() {
List<Integer> random = new Integer[2];
random.set(0, Math.round(Math.random()*100));
random.set(1, Math.round(Math.random()*100));
return random.get(0);
return random.get(1);
}
I need to return two random numbers in getRandomNumber1 class.
Then I display two random numbers in a visualforce page.
I appreciate any advice.
thanks
You can't return two numbers with two return statements - your method will exit at the first return statement. Return the List of integers instead.
In your visualforce page use a dataTable or pageBlockTable to display the list.