Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: James Rivera   on Nov 14 In Java Category.

  
Question Answered By: Erika Evans   on Nov 14

As I droped java a long time, correct me if I'm wrong

I remember this statement  is only use as a "declare and initialize"
statement, such as:

String arr[]={"hello", "world"]; // two element array

The number of elements is counted during complie. But a single
String s[];

I didn't see that ever. Maybe a compile error pops to request the number
of array, or a default length, 0, is added to it. If the latter one is
true, since an array  object cannot be appended at runtime, it's just a
String[] all the time, maybe it can be used with a RTTI purpose, I'm not
sure it can pass compiler. Have a try, I cannot try since no JDK
installed in the computer I'm just writting.

Share: