This might be a stupid question but I can't figure out how to set my array equal to my method which returns an array.

This is what I did and there's an error. :/

array=array.resize();

Thanks guys

Recommended Answers

All 5 Replies

What is the error??

Example

int[] numbers = getNumbers();


private int[] getNumbers(){
    int[] numbers = new int[10];
    //some code to populate array

    return numbers;
}

You then can use peter_budo's method like this:

int[] varArr = getNumbers();

It is already there. Check first line ;)

Good news: still know my Java.
Bad news: need to get my eyes checked.

:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.