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.
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
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!
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
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 :)
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.
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.
whereisthespacebar?
BenjaminHeels 7 months ago
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
syhaile 11 months ago
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 1 year ago
@JUanBOBO You are right..
lnpkural 1 year ago
this motherfucker doesn't know anything, ha ha....
keylllogdark 1 year ago
dude am soo confused
please explain
ronny22 1 year ago
I am sorry, but I agree with most of the comments bellow. You just type and lack in explanation. =\
wsyuk 1 year ago
Don't just speak what you're typing. Explain what you're doing and why..what this video is, soforth. Come on, man.
Final137 1 year ago
you are just typing, not explaining....
GotemCZ 2 years ago
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.
BajanCreation 2 years ago
most youtube videos are a lot more simplistic because they don't actually teach programming they just teach syntax
TheEarlOfDublin 2 years ago
EXCELLENT MAN! U ROCK...i was looking for one just like this
thx :)
aveond2009 2 years ago
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)
NajanJan 3 years ago
That is a way to do it, or using ArrayList/LinkedList
senos64 3 years ago
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
BigE726 3 years ago 6
True, i'm not sure he realises that though.
rhillner 3 years ago
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 1 year ago
@stedav WRONG! If you add to an array beyond it's specified size, you will get an ArrayIndexOutOfBounds runtime exception. Go learn java.
555pontifex 1 year ago
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
konessh 3 years ago 7
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
ronny22 3 years ago
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 :)
Pablos544 3 years ago
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
dosattack777 3 years ago
Why do you whisper on every of your videos, speak up.
I need to turn volume up when I watch it.
systat 3 years ago
where is the first one on arrays?
jrprince21 3 years ago
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.
Yell0wGuy 4 years ago
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.
omnius34 4 years ago
The best alternative would be to use the ArrayList class from java.util, IMHO.
I agree, I love Eclipse!
muchomuse 4 years ago
Or even better use C#.
romanking123 4 years ago
C# sucks.
rhillner 3 years ago
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.
howeworth 4 years ago
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.
Yell0wGuy 4 years ago
It would be helpful to see more of the screen
Brian091246 4 years ago
And what's so advanced about your arrays?
ariakokoschka 4 years ago
Netbeans is a great IDE so is Eclipse just a matter of taste.
gorilla3d 4 years ago
with that program did you record this with?
jajaja0 4 years ago
..and why Netbeans?
short before the end I wonderd if you´d really not show ArrayList
jajaja0 4 years ago