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

Trending Topics

Online now

Members online
1,309
Guests online
3,469
Total visitors
4,778

Forum statistics

Threads
2,305,826
Posts
29,168,073
Members
1,195,464
Latest member
tibolok
Back
Top