Added: 4 years ago
From: gorilla3d
Views: 44,335
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:
see all

All Comments (35)

Sign In or Sign Up now to post a comment!
  • whereisthespacebar?

  • You do this and that and throw in some lightbulbs and Bam... Beautiful Explanation on how to use ARRAYs, but I still think I should look more into it

  • why to you have to convert the array element into a String? i don't see the point because if you out put the integer it would still be 11.

  • @JUanBOBO You are right..

  • this motherfucker doesn't know anything, ha ha....

  • dude am soo confused

    please explain

  • I am sorry, but I agree with most of the comments bellow. You just type and lack in explanation. =\

  • Don't just speak what you're typing. Explain what you're doing and why..what this video is, soforth. Come on, man.

  • you are just typing, not explaining....

  • programming languages can be easily taught but i find people especially those ;ecturers at universities talk all over thier faces and go from US to Russia to explain basic questions.

  • most youtube videos are a lot more simplistic because they don't actually teach programming they just teach syntax

  • EXCELLENT MAN! U ROCK...i was looking for one just like this

    thx :)

  • thanks for the tutorial.

    I have a question. if we're making array of objects and we want to have 3 constructors let's call it, what would we put in each constructor?

    MyArray ()

    MyArray (int initCapacity)

    MyArray (Object[] a)

  • That is a way to do it, or using ArrayList/LinkedList

  • Minor thing.... you use the word "Integer" to describe your 'int array' there is a difference between 'int' and 'Integer'.... an 'int' is a primitive data type an 'Integer' is the wrapper clas that allows you to treat int's like objects not really that important but this differnce could confuse people if they go into the complexities of java programming

  • True, i'm not sure he realises that though.

  • BigE76 is absolutely correct, the confusion from this tutorial is evident. An int is a primitive type, and the Wrapper class Integer is an Object, with different behavior for each. The Wrapper class Integer has a default value of null, whilst the int is 0; this is a big difference in Arrays.t Further the size attribute in an array is a guide to the compiler about the minimum length, if you wish to add to the array you don't need to reassign the reference to a new array!

  • @stedav WRONG! If you add to an array beyond it's specified size, you will get an ArrayIndexOutOfBounds runtime exception. Go learn java.

  • Well, nice tutorial about how NOT TO use arrays in Java.

    1., the worst thing you can do is to allocate memory for a larger array every time you want to add a new element to it. Have a look at the source code of the ArrayList class, and see that it operates on arrays behind the scenes. The best practice is to check whether there is enough space for the new element before you insert, and double the size once it is full.

    2. java.util.Arrays.copy -- most cost-effective way of copying values

  • am sorri but u lost me on this vid

    got confused with the numbers such as 65 or 45 etc.. if u can please will u be able to explaine it in more depth

  • That wasn't a bad start at all but i found your voice lacked any volume. Was somebody eavesdropping?! I tried to follow it but it wasn't easy. But thanks anyway, what i managed to get sounded interesting :)

  • thats not true u dont have to erase your current array. u can very easily create a temp array to pull values out of 2 u know

  • Why do you whisper on every of your videos, speak up.

    I need to turn volume up when I watch it.

  • where is the first one on arrays?

  • 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.

  • 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 alternative would be to use the ArrayList class from java.util, IMHO.

    I agree, I love Eclipse!

  • Or even better use C#.

  • C# sucks.

  • 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[­0]); the println method is overloaded and it accepts also values of the data type int as arguments.

  • 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.

  • It would be helpful to see more of the screen

  • And what's so advanced about your arrays?

  • Netbeans is a great IDE so is Eclipse just a matter of taste.

  • with that program did you record this with?

  • ..and why Netbeans?

    short before the end I wonderd if you´d really not show ArrayList

Loading...
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more