In Java, if you want to know the length of a String, you do:
myString.length()
But for an array, you do:
myArray.length
What is length for arrays? A property like in C#? A public field ?
Thanks.
PS: While we're at it, what's the equivalent of a C# "using" statement in Java? For instance I want to use
int k = java.lang.Math.min(a, b);
And write something like
using java.lang.Math;
int k = min(a, b);
When I write "import java.lang.Math;", I still get "min is undefined", and when I add ".*" at the end (which I don't understand anyway, but I've seen import java.util.*; pretty often), it doesn't work any better.
Question
Andre S. Veteran
In Java, if you want to know the length of a String, you do:
myString.length()
But for an array, you do:
myArray.length
What is length for arrays? A property like in C#? A public field ?
Thanks.
PS: While we're at it, what's the equivalent of a C# "using" statement in Java? For instance I want to use
And write something like
When I write "import java.lang.Math;", I still get "min is undefined", and when I add ".*" at the end (which I don't understand anyway, but I've seen import java.util.*; pretty often), it doesn't work any better.
Edited by Dr_AsikLink to comment
Share on other sites
6 answers to this question
Recommended Posts