What (if anything) is the difference between these two?
String[] sa = {"ABC"};
String[] sa = new String [] {"ABC"};
What (if anything) is the difference between these two?
String[] sa = {"ABC"};
String[] sa = new String [] {"ABC"};
The one thing I dislike about Java: repeating yourself.
- WolfShield
Hmmm...
I say they are the same.
I think (in Java and C#) using the {} calls "new".
...testing...
Well, I created two programs with the same variable names and same class names, compiled them and ran fc /b over them:
"FC: no differences encountered" at the byte level.
The byte code test looks like a definitive answer to me. Case closed. Thanks Tom.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.