forum

home / developersection / forums / how to write an array format using java

How to write an array format using java

Madam Walker 2566 14-Oct-2013

I have declared this variable in class(something), here is the code

long test[];

int year;

and I have declared a method(something) in class(something). here is the code

public void something(long check[],int year) {

    for(int i=0;i<=1;i++){
    test[i]=check[i];
    }
    this.year=year;
}


and then in the main class,i tried to set the value of jumlah[] and tahun, here is the code

something dood = new something();

dood.something("the error",2013);//error here


the error was

required: long[]

found: String


So, my question is, what is the right syntax do set the array values of jumlah[] or replacing "the error"?

I've tried {123,321},[123,321],[{123,321}] and it doesn't work.


Updated on 14-Oct-2013
Madam Walker

Other


Message
Can you answer this question?

Answer

1 Answers

Liked By