When I try to declare a static array in my program, I get a static direct link error, I'm not sure what I'm doing wrong here ...
static Square fieldGrid [ ] [ ] = new Square [ ROWSIZE ] [ COLSIZE ];
this is what i use.
Preferred syntax:
static Square[][] fieldGrid = new Square [ ROWSIZE ] [ COLSIZE ];
Also, were you declared and initialized by ROWSIZE and COLSIZE at the time this announcement was created?
ROWSIZE
COLSIZE
The ROWSIZE and COLSIZE fields must be initialized before they are used to create a square array. The Java language specification indicates why this restriction exists in place :
These limits are designed to capture, during compilation, cyclical or otherwise distorted initializations.
Are strings declared and initialized and colsize before this string? Since they are static, I think the order of the declaration matters.
I assume that ROWSIZE and COLSIZE are static final ints, and they are declared after an array declaration. Change the order (first declare and initialize ROWSIZE and COLSIZE), and then use them.
Source: https://habr.com/ru/post/1305902/More articles:How to select a specific node context native language using jQuery? - jqueryHow to disconnect a .NET network connection without requiring administrator privileges? - vb.netPohlig-Hellman algorithm for computing discrete logarithms - mathGetting MAX_INT from NSDateComponents - objective-cAccessing variables between nested JSP tags - javaCan I use POSIX signals in my Perl program to create event programming? - unixfputs crash in C on Mac with Xcode - cSQL - search for continuous records of a given size - sqlHow can I use pipe to facilitate interprocess communication in Perl? - perlhttps://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1305907/sizeof-continues-to-return-4-instead-of-actual-size&usg=ALkJrhh46Os03W_LyZNSpXaLf7pHv_79PAAll Articles