Re: variables and efficiency
I believe all of Java's Collections API classes store the size of the collection inside of a variable, so for all practical cases the efficiency of both methods are pretty much the same.
Re: variables and efficiency
Well if you're actually using an array such as String[] then you can use the length variable whenever you wish, its a normal variable after all and not a method call.
And if you decide to use an ArrayList and call the size() method all that does is return the instance member int size. So like helloworld says, no biggie really. Use whatever you wish without storing it in a new variable, in fact, storing it in a new variable might take more time :)
// Json
Re: variables and efficiency
thank you for the replies