How to unroll and append elements to an array.
Netbeans 5.5.1 beta
Duration : 0:9:20
with that program … with that program did you record this with?
..and why Netbeans? … ..and why Netbeans?
short before the end I wonderd if you´d really not show ArrayList
Netbeans is a great … Netbeans is a great IDE so is Eclipse just a matter of taste.
And what’s so … And what’s so advanced about your arrays?
It would be helpful … It would be helpful to see more of the screen
Well, not bad, BUT: … Well, not bad, BUT:
First of all, it’s not called the main function but the main method! There are no functions in Java. You could call a method that returns a value a function, but you certainly cannot call a void method like that, which could be called a procedure.
2nd: There’s no need to use the toString method of the Integer class, you could simply write System.out.println(lightbulbs); the println method is overloaded and it accepts also values of the data type int as arguments.
It is a nice … It is a nice example of use of arrays but the application is not practical. For instance if the array gets large in size the amount of overhead will exponentially increase.
An alternative would be to either allocate the array with ample values or use dynamically allocating pointers. Perhaps a linked list.
Eclipse is a better IDE. It doesnt bring my cpu utilization to 100% and Eclipse has plugins for almost anything you can think of.
The best … The best alternative would be to use the ArrayList class from java.util, IMHO.
I agree, I love Eclipse!
Methods, functions. … Methods, functions… not a big deal. In C you are taught that they’re all called functions, even when the return type is void.
After all, this isn’t math nor functional programming.
For the array … For the array version, there is a handy method Arrays.copyOf() to replace the loop. It even sets the array length of the copy to the one you specify.
Or even better use … Or even better use C#.
Mail (will not be published) (required)
Posted on May 13th, 2007 by admin
Filed under Java Basics | 11 Comments »
Copyright © 2007 TechOnVideo