Reputation: 49
I am trying to convert some Java to C# and I have a line as follows:
int[][] variableName = get();
What my question is is what does "get();" actually do? There is no function or method in the Java code I am converting called "get()" so I am assuming "get();" simply creates an empty object of the required type, in this case, an empty int[][]. Would I be correct in this assumption or does "get()" in Java have some other meaning?
I have searched for "get()" within stackoverflow but the () are ignored and as a result I get masses of information about HTTP GET which is not what I'm after so excuse me if this is duplicated anywhere else.
All help appreciated.
Upvotes: 0
Views: 409
Reputation: 1075199
There is no function or method in the Java code I am converting called "get()"
There must be, either in that class or one of its superclasses, or as a static import although that's not very likely. (Nice one, Jesper!) My guess is that you haven't checked all of the superclasses.
...so I am assuming "get();" simply creates an empty object of the required type, in this case, an empty int[][]. Would I be correct in this assumption or does "get()" in Java have some other meaning?
No, unlike C#, get
is not a keyword and has no special meaning in Java. That line of code calls a method called get
(it could just as easily be called foo
) which is declared in the class or one of its superclasses. It may be a static
or instance method, but it will be defined by the class or one of its superclasses, or as a static import.
Upvotes: 3