Added: 2 years ago
From: thenewboston
Views: 121,522
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:

All Comments (180)

Sign In or Sign Up now to post a comment!
  • so basically typing for(int x: bucky).... is just a shortcut for typing

    for(int x = 0;x<bucky.length;x++)???

  • @N1G3L2 if I'm not mistaken with"for(int x = 0;x<bucky.length;x++)" you'll need to tutoal+=total+bucky[x] unlike what's described in the video where you just need to use total+=x. I think the whole idea is NOT to deal with array after for! or maybe not!

  • WTF!? female genital mutilation in the related videos??? fuck you youtube, im trying to learn java. stop trying to depress me.

  • @AnnoyedDragon

    The way i think of it is so the

    Int

    Is the data type, the

    X

    Is a variable created because you need one m(i will explain in a bit) because if you wanted to print them all out you would have to do

    System.out.println(bucky[0])

    Or whatever, so it would be pretty pointless, and the

    Bucky

    Is the the name of the array, so its made for arrays and only arrays, and then what you wanna do with the elements of the array. The reason there is X is because everytime it loops it assigns the

  • I'm confused.

    I can see the for loop is assigning bucky's values to x, plus the total is adding x to itself each loop. But what is controlling which of bucky's values are being added to x?

    The way I'd usually go about this would be to have a counter increasing each loop until a desired figure is reached, with bucky[counter] identifying which of bucky's values I want to access. Counter 0 accessing bucky 0 and then 1, 2, 3 etc.

    I don't see what is controlling this in this videos code.

  • Interesting fact: With the "enhanced for loop" you can not change the integer stored in the array.You can only read-access them. I tried, it wouldn't work, I looked it up. So you still have to use the (int x=0;x<100;x++) to change the information stored within the array.

  • Comment removed

  • Comment removed

  • i know basic array but what is array initiliazer??

  • @lyrrad999 Initializing is setting a first value for a variable. It's kinda inactive or something before then (Correct me if I'm wrong)

  • can someone explain me what int bucky[]={3,4,5,6,7}; ???

  • @lyrrad999 instead of writing int bucky[5] and then writing out all the values like this:

    bucky[0] = 3

    bucky[1] = 4

    etc...

    You write int bucky[]={3,4,5,6,7};

    the [] after the int (integer) and variable title indicates it's a array. Also, the items in the curly brackets {} are the "bucky[0] = 3"s. If someone can better explain this that'd be great. If you are still confused, watch episode 27 of this series.

  • This doesn't work anymore, could you please make a tutorial on how to do it in JRE 6.0?

  • what?

    

  • y u say statement

  • morning wood sounds practical

  • Does anyone know of any tools that I could use to review/brush up on the information from these tutorials.

    The tutorials are great but after a day I tend to forget stuff. Anything like worksheets, quizzes, games, questionnaires, exercises or challenges would be perfect and would help a long way.

  • @TheSamLegacy One thing i have been doing is keeping a note book for these tutorials. That way i follow along in eclipse during the video, and then afterwards redo it in pen on paper(with explanations of each thing). That has helped me tons to remember all of the info!

  • @TheSamLegacy just make another folder called Practice or something and just practice making stuff in there

  • I scrolled down to the top comments just to see who commented about Dog Wood.

  • TO CLEAR IT OUT it is the same as this:

    for(int counter=0;counter<bucky.length­;counter++){ x=bucky[counter]; (in the example he adds it so he use it like this:) total += x }

    You can use the variable x as you want to. In this he use it to keep the sum

  • if its not made by "thenewboston" then what is it

  • Dog would... what? What would the dog?! Don't leave us hanging like that!

  • Is it bad that I watch one and then forget it

  • @DCM0Dz

    Try to recreate what he did without watching the video after you watch the tutorial. This should make you think about it and hopefully remember it better. Also try to make a slightly different program to the ones he makes. e.g. instead of summing all the values, average them instead.

  • so is this like a shortcut method? i mean its the same thing as

    (for int i=0; i<array.length; i++) but its the simplified version of it rite?

    and will enhanced for loop work for multiplication, division and subtraction? or does it only work for addition?

  • @blazedraco29 not really this is going to make a loop which loops through as many times as the array is long you're right about that but every time x has an different value depending on the array in your way i wich is x in that case only adds on each time instead of 3 then 4 then 5 ...

  • @dieoma100 oh ok, thx :)

  • @blazedraco29 Actually, it's even more of a shortcut! See, it takes the x variable and sets its value to whatever number is stored in the storage space in the array.

  • Why is there no mention that the construct being worked with here is an iterator? It would help too if you could explain how the enhanced for loop should actually be read ie. "for every integer variable called x in the array called bucky"...I know you are trying to make things simple, but just a few more details would help.

  • Is it normal that Ive been kinda confused the past couple videos im feeling more and more lost lol its gotten too the point where im just copying what he does

  • from wiki: The genus Cornus is a group of about 30-60 species[Note 1] of woody plants in the family Cornaceae, commonly known as dogwoods.

    i thought dogwood was just a dick

  • Why do you have set int total to zero? I thought int types are set to zero by default? I get an error if don't initialize it.

  • @forexdragon Hey mate, I think int's are not actually set to zero when they are initialized. I'm pretty sure they're set to "null." It's one of those funny things, as humans we think of "null" and "0" as the same thing, but a computer sees them as different.

    A computer sees "null" as the "absence of a value", but it sees "0" as having a value.

    Hope you found this helpful :)

  • @9trepkos9

    You are right. Now it totally makes sense. Thanks!

  • i dont get it,how did the for ended?

    he didnt used a counter.!!!

  • @ChrisTheBest1992 There were 5 items in the array, so it runs 5 times.

  • it seems like a recursion...the loops.

  • this tutorial series is awesome! thank you dude

  • Thank you Bucky, great tutorials, nice tempo...

  • what happens if the position [0] of the array is empty, does it start looping from [1]? or is there an error?

  • to everyone who wants to write minecraft plugins for bukkit etc.

    I wrote since now 5 plugins, they are even accepted on bukkit dev.

    -AntiEnderPick

    -Enlete

    -LastChance

    And all that only from tutorials to 20!

  • @DJCronxx Where do you get the code, I can see class files, but can you edit those?

  • @JKTCGMV13 those are my compliled class files, which you shouldt touc or even

    cant. because class files are bytecode, the stuff you write in eclipse is everytime a java file

  • cannot convert from int to boolean. WHAT DOES THAT MEAN???

  • @ziodice Int and boolean are two different types of variables. Int is a number without decimals, but a boolean variable is either true or false. Obviously you can't switch between them since they are in no way the same.

  • @Gunnarsen94 But I copied his code exactly!

  • @ziodice you sure? i dont see why you would get that error if you are not using any boolean

  • @Xeinnex1 Well. THere is a SLIGHT difference. I have a seperate class, made simply to make the other classes activate, just so I remember how (Classes confuse me, sadly)

  • @ziodice i would have to see your code to be able to help you then, you should know programmers spend more time fixing errors like that one than they do typing the code itself, its just that bucky makes it look so easy, send me a msg if you want more help or if you manage to post your code somewhere send me the link and i can help you :)

  • @Xeinnex1 Sadly, my computer crashed, and the code was lost. And I BET, if I try again, copying the code exactly like i did before, it will work.

  • 40 and going

  • is like foreach in php;p

  • @rustondust loop through the loop multiple times :D!

  • THANKS FOR ALL YOUR VIDEOS!! You are a massive help thank you so much!! :D <3

  • oy bucky^^ Thunfisch german skillz are german^^

  • One itsy bitsy problem with this, if you are going to multiply, it takes the original 0 too, making your answer always 0. Going to fix this with what you taught me though as a test before I move forward. =p

  • @RazorSRaider Oh wow im stupid... all you have to do is change total's initial value from 0 to 1 in order to fix this lawl. and here I was adding 6 extra lines of code

  • windows 7 snap feature makes this sooooo much easier to follow

  • @sublimeftw2 Ubuntu, a linux distribution, also has it. :)

  • @sublimeftw2 I highly recommend investing in dual monitors.

  • English is my 3rd language, and im just 14 years old.

    but thanks to bucky i learned HTML, JavaScript, and some CSS.

    and now im learning Java and i get better and better through time, all that thanks to bucky's great teaching methods and simple way of talking so everybody can understand him, he's international :)

  • This is a lot easier in python.

    "one for loop to loop them all..."

    Well I guess "one does not simply walk into programming."

  • Trivia:

    This enhanced for loop is also called the for each loop.

    You could also read "for(int x : bucky) {} " as "for each integer x in bucky..."

  • great bucky u rock! :)

  • Dogwood! :)

  • I understood this video easily thank you for these tutorials!

  • can we use it for summing 2D arrays ?

  • Comment removed

  • Can you as an Enhanced Loop on more then one array at a time? If so, what is the synthax? Thanks!

  • saved me 50 bucks from buying a textbook :P

  • man you convinced me that watching these tutorials wasn't a waste of time

  • why does the enhanced for loop end when the array ends? how does it know were to stop? is there any ways to make the enhanced for loop go through multiple times?

  • hows this different than summing elements?

  • @hizzleyo It is the same, it's just an easier way.

  • wow

  • syso + CTRL + ENTER

  • I noticed they were made on the same day too

  • Does anyone else notice these videos were all uploaded on the same day? Dude is committed. I like it.

  • Such a shame to see viewers drop off... I wonder how many make it to the end?

  • dog wood..how did you know

  • can i use another variable instead of x?

  • @Arluness

    Yes, you can name it whatever you want!

  • 2 people like Dog Wood.

  • @MAGStation THEY ARE 5 now lol

  • For C# users, this is a Foreach

  • Thanx A LOT Buckey very clear and explination.

  • Thanks v v v v v v v v v  much.keep on uploading such a nice tutorials.

  • Great tutotial! :)

  • He said "What's up guys, it's fucky." :P

  • This is basicly foreach, from PHP.

  • Bucky you are the shit, and I don't think some people realize that you need to learn everything before you can just skip to the important stuff. He's making something thats super hard out of a text book really easy to understand, and you tards should appreciate that.

  • @PkingGodCats But then he helps us for it! Lol. *Troll* -.-

  • I'm a child programmer and even I understand this stuff.

  • @jreynol100 Lol, since your a child, you - of all - should understand this since it's a lot easier to learn something for a child..

  • @g0rmi I would have to disagree, yes it is easier for a child to be enthused about something and want to learn more but I think that adults have the advantage of understanding the overall systems used. (I guess you would consider me a child programmer too FYI).

  • @OfftopicCreations Okay.. I guess your right about something.. For newcomer adults compared to newcomer children, programming properly makes more sense to adults, but it's so much easier to integrate something to your mind and learn new stuff in general for a child.. BTW, I would also consider myself as a child in an age of 16 :)

  • its really good to use 0 if you are talking about addition but if you went ahead and tried multiplication there you total+*=x;, you would realize that it would be zerio because you a multiplying total by (3,4,5,6,7), but if you did what i did and set it to one instead, you would get the actual value of all numbers in the array being multiplied by eachother.

    ty!

  • same as foreach loop in c#

  • bucky, tunafish, dogwood

    classic bucky lol

  • @cpgamer you are so pathetic. I bet you love to be the centre of attention in your crumby little world. Bucky your the boss.

  • @cpgamer you are so pathetic. I bet you love to be the centre of attention in your crumby little world. Bucky your the boss.

  • She is so sexy and Latino women rockmycity.info

  • wow it just adds up all the numbers. how boring, just like the past tutorials ) : cant wait till GUI. sigh......

  • Bucky talks to Java in the same way as he talks to his gfs..with love..

  • what would i need to to if i only wanted to add the numbers within an array that were not negative? Assuming that there are negative numbers within the array.

  • @nnnb Make an if-statement to check if x is larger (or equals to) zero in the for-loop. If it is, add x to the total-variable

  • Great tuts but I can never remember them :(

  • @JoeAlcorn I would try typing the code out and saving it. Once you do things a couple of times you don't forget them and you can always look back to see what you did.

  • @JoeAlcorn Same here, I feel like I've learned nothing so far.

  • @SuperBearzilla That's just because it's a totally new language you're learning, the key is repetition, then it'll stick.

  • @MrSelkies Yea, I've been reading books and watching these videos, but so far nothing. I think I might need a 2 day break, then I'll come back to it.

  • LMAO @ dogwood

  • hmmm...isn't this program pretty much similar from the tutorial of summing the array values?

  • @noTmiZ This tutorial is introducing the enhanced for loop with only one variable and one array. So another way to reach a simular result I guess you could say.

  • makes great sense. thank you so much.

  • Bucky your really good

    i bet you already know this but if you type "syso" and click ctrl space it will write System.out.println(); automatically for you :)

    continue making great vids

  • no more reading! wohhooo!

  • lol.. on this one you had to think ... oh.. let's see.. 31st Java tutorial..lol.. NICE VIDEOS... Excellent job... Thanks a billion..

  • do u have examples of these using buffered??

  • Why u type System.out.printline("") isted sout+tab :)

  • I wonder who are the idiots with the thumb dawn... how can anyone just ignore how much these videos help.....!

  • dogwood? where did that come from?

  • i think i need to rewatch all of the vids

    i dont seem to get any of this

  • @tomek123kotek nothing wrong with that man. Do it until u get it. Good luck.

  • its a good tutorial but java is overly complicated... it does in 5 lines what i can do in 1 on python

  • @tomek123kotek While this is true, a language like C would take even more lines to do the same thing. Java is still pretty simple compared to many languages.

  • @tomek123kotek really?. I never took python. Can u give me a quick example.?

  • @2yung4grey find some tutorials on this guys channel... they are really nice... the only prob is hat even if you can do more faster in python... when it comes to making games and guis and things you would finds in real programs it gets much more complex

  • Can this be done with more than 1D arrays ?

  • I always thought there was nothing like a for each loop in java.

    no i know better

  • i am thankful to you.... dude u are great... i really appreciate your work....

  • Comment removed

  • Comment removed

  • I think this one is similar to the "foreach" statement in other languages...

  • @after731 Java has for each

    wikipedia(dot)org/wiki/Foreach­#Java

  • Is this available in C? I have never saw this syntax for "for" loop...

    Good tutorial, better then any on first 30.. :P

  • its really nice guy.

  • never learned this in school at least not that i can remember... so can u use this instead of array.length to loop through your array or is it still proper to use the original way

  • Wow, all your tutorials...

    Are the best tutorials on youtube!!!

    U are the best one!!!! :)

  • Wow, java is so much nicer than C

  • @RaymondCorrigan ....then tell me why almost all major games and soft ware is written in c or C++?

  • @MrMelonBread

    Because shutup, that`s why.

    With your fancy facts and figures... Actually that`s a pretty good point.

    Perhaps I should have said much nicer for programming noobs like me. : )

  • @RaymondCorrigan Sorry did not mean to come off like a jerk, just wanted to bring that up to show that it is still commonly used and no reason to write it off and not learn it

  • @MrMelonBread

    It`s okay, you didn`t come off as a jerk. I just never miss a chance to quote Futurama. I did a C unit at university, but Java`s syntax just seems to agree with my brain more.

  • GREAT ... i passed 2 exams so far only because of u :)

  • Hmm...Let's see here. Should I spend like 1000 hours reading Java books, or just watch your videos?

    Thanks again bucky!

  • hi there can u make an array inside a GUI application?..

  • Yes, GUI applications are exactly the same as non, except they look pretty, and have the graphic interface. The actual computation is the same.

  • I owe my A in my java class to Bucky

  • so an enhanced for loop can only be used with an array? plz respond  and thx

  • @ghjurx452 it looks like foreach statment so itshould take values from listboxes

    ,comboboxes too etc.

    eg. in c# it looks like this.

    foreach(object in listbox)

    { //do this

    }

  • yes only arrays

  • yea, i believe so

  • i never used the improved for loop , i am loking to use it, i used iterator instead of it. for any suggestion or comment have a chat with me at skype/google/googletalk =hmk25061984

  • Tus tutoriales son excelentes, he empezado de cero y son fácil de entender, gracias por este gran aporte

  • 3AM and u still doing this. good job. Thanks alot

  • thanks , I have just learn new easy way to sum up array elements

  • lmao dogwood. i just started laughin. i love your vids bucky!

  • imma keep going til the last one...taking extremely short breaks every now & then...

  • Bucky rocks!!!

  • keep up the good work bucky

  • Your Java Tutorial is a life saver! Those boring school books.. Your videos is just the best!

    Keep up the good work!

  • thanks for tutorial

  • lol @ Uploadvidz.

    Keep up the learning.

  • this is great - i'm learning alot.. but i do think after im done watching the 50th tutorial i need to wait for more tuts to come and maybe watch them all again to understand them a lil more, i just watched 31 videos in a row, so its hard to put and keep all that data in my head lol

  • @Uploadvidz

    same here...

  • bucky u r really genius to make us explain all these things an that to so easily.