🔒 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
  • 503
    Views
  • 3
    Participants
Last reply from:
aa1012

Trending Topics

Online now

Members online
1,235
Guests online
1,460
Total visitors
2,695

Forum statistics

Threads
2,287,342
Posts
29,044,002
Members
1,216,478
Latest member
kirolololol
Back
Top