🔒 Closed Error int[] array initialized in private method

Status
Not open for further replies.

Princess Serrano

Honorary Poster
Bakit ganooonnnnnn??

public class Main {
private int[] a, b;

private void setup() {
this.a = {3,5,3}; // error
this.b = {4,3,3,2,4,54}; // error
}
}
 
I dont know if this is Java or C# but in C# it should be something like this:

Code:
private void setup()
{
    int[] a = new int[] {3,5,3};
    int[] b = new int[] {4,3,3,2,4,54};
}

In Java:

Code:
int a[]={3,5,3};
 
Status
Not open for further replies.

About this Thread

  • 2
    Replies
  • 498
    Views
  • 3
    Participants
Last reply from:
aa1012

Online now

Members online
865
Guests online
1,479
Total visitors
2,344

Forum statistics

Threads
2,276,102
Posts
28,967,629
Members
1,231,120
Latest member
younes
Back
Top