Menu

#1 String[] parameter

open
nobody
None
5
2004-01-22
2004-01-22
No

I'm using j2sdk 1.4.1_03 for win32

When one of the parameters (or return type) to a
problem is a String[], the class will not compile.

For example,

public class Problem
{
public String[] method(int[] param)
{
// ...
}

public static void main(String[] args)
{
//...
validateExample("1", new Problem().method({1,2,3,4}),
{"a","b","c","d",});
//...
}

//...
}

This will not compile unless I change the String array
declaration to:

new String[] {"a","b","c","d"}

But this is not needed with the int[].

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.