I'm having difficulty understanding why one can't simply output ..."The sum of these numbers is " sum); Why all of the sudden, after appending the sum+=bucky[counter];, do you have to use +sum?
@Lennybird91 It does seem a bit odd to have to use a '+' before sum, but the fact remains that no matter what you pack on other than the initial "The sum of ____ is", will need one. So when you think about it, you still are adding -in a sense- to the rest of the println. Hope that helps... Somehow.
People always comment on how the views go down with each video. They aren't really going down any more but you can see from the comments that most people are watching for college or uni
@TheViolinCalamity look at the playlist. it gets down to like 45k people. and once it was in the 30s. but i have to agree with most people that stay. this guy is the best!
@BigRunescapeBrain Counter-Grammar-Nazi-Activated: It's "it's," not "its" when not discussing possession. ;-)
As for what you pointed out, we fall into vague territory. Considering words such as "team" or "group" when in unison are both still singular, one might question whether the "sum" is behaving as singular. This of course depends, as I've neglected to remember the importance prepositional phrases ("of these numbers") when noting the plurality of the verb. Doh.
Hey bucky, i really need help with this/ if anyone else knows.
I am building a calculators using arrays and embedded ifs but i am trying to create an array to store functions like */-+ and i can't seem to work out the syntax for symbol (reply with answer or if you don't understand my meaning).
@caseyguitarist you can't store operaters into variables if that's what you're trying to do. i would just make a switch statement prompting each function (add, multiply, divide, etc...). idk if that's what your asking but my beginner brain tells me to do that.......
You shouldn't have gotten the same result, "sum+=bucky[counter]" would look for the number in the array counter is, so if counter was 0 the number in the array would be 21, etc.. Then it would add the array numbers. In "sum+=counter" it would just add the counter numbers, so you should get a number like 5 or 6 or something.
@fortawesomm I made a little text based blackjack game in c++ that I never finished. Now imagine all the cards and suits. You would have to make like 52 variables for each different card. Instead, you can just make 2 array.
@fortawesomm when you start to make games, you will have to make a different variable for every pixel showed in the frame, in that case, if you have like 800 by 640 pixels, that would suck to make that many variables. instead you will use arrays. but you will actually be making multi dimensional arrays. which you will learn later if you keep watching these videos.
@ChrisTheBest1992 it adds on to whatever was previously saved to that value. say you initialised an integer sum = 2; if you were to do something lile 'sum += sum + 1' and output sum you would get 5. This is because it acts as 5 + (2+1). Hope that helps.
2 days ago a was a 22 years old university student that was studying computer engineering and tried to cheat my Java exams. After im done with these tutorials my teacher is going to cheat so she can give me less points in the upcoming exams.
THX MAN!!!! :D Finnaly i finníshed this :) Added some good stuffs :) Now the program will typ out all the Numbers like this "Numbers: 21,16,86,21,3"
And on the next line it will print out the sum of those numbers like this "The sum of these number is 147" And on the third line it will tell the avagre of them :) Like this "The avagre of those numbers is 29" :D I have been watching your videos all day :) So i have been total watched 29 of your videos now :) And i'm learning alll the time!
@sporreking That would be awesome! I wonder why have the people that start programming are around my age(12). Is it just for games? simply because of minecraft? haha
public class apples{ public static void main(String[] args) { int kyte[]={32,45,56,78,90}; int sum=0; for(int counter=0;counter<kyte.length;counter++);{ sum+=kyte[counter]; } System.out.println("the sum of these numbers is 147" +sum); }
}
IT KEEPS SAYING THE COUNTER IN THE SQUARE BRACKETS IS AN ERROR :(
@kyte95 because there's a semicolon after the for loop condition ..
public class apples{ public static void main(String[] args) { int kyte[]={32,45,56,78,90}; int sum=0; for(int counter=0;counter<kyte.length;counter++){ sum+=kyte[counter]; } System.out.println("the sum of these numbers is " +sum); }
bucky what about adding something to the array or deleting something from it should we use search ?!! like for example
public boolean addNbChildren(String name, int nbch){ int index = this.searchIndexOfEmployee(naa); if(index !=-1){ NbChildren[index]=nbch; return true; } return false; } tell as about adding and deleting in array if you may thanks ..
bucky what about adding something to the array or deleting something from it should we use search ?!! like for example
public boolean addNbChildren(String name, int nbch){ int index = this.searchIndexOfEmployee(naa); if(index !=-1){ NbChildren[index]=nbch; return true; } return false; } tell as about adding and deleting in array if you may thanks ..
bucky what about adding something to the array or deleting something from it should we use search ?!! like for example
public boolean addNbChildren(String name, int nbch){ int index = this.searchIndexOfEmployee(naa); if(index !=-1){ NbChildren[index]=nbch; return true; } return false; } tell as about adding and deleting in array if you may thanks ..
If you think there's any chance you could be summing a large array, or one with large int values, you may want to make your sum variable to be of type long to prevent overflow. A long is the same is an int but can store a much bigger range of values.
@peeyam , actually if you do as bucky does your array will be like bucky[0] bucky [1] ... bucky[4] , but if you add "=" , it will get one more value , but since array content only five values , bucky[5] doesn't exist.And you are out of 0,1,...,4 index.
shouldn't line 7 have "counter<=bucky.length"??? I know it works, but when it gets to bucky[5].. it shouldn't add the "3" to it... and if I put the "=" sign in.. I get an error "Exception in thread "main" java.lang.ArrayIndexoutOfBoundsException: 5 at apples.main(apples.java.:8)
im geetin this error message Exception in thread "main" java.lang.Error: Unresolved compilation problem: counter cannot be resolved to a variable at apples.main(apples.java:7)
hey bucky what if all numbers that i want to add is in a variable? and what if the array length is based on what the user will input in another variable? hope u get wat i want to do! pls help
BTW gaiz, if you add a sum=sum/bucky.length; and then output it on the screen you can get the array average, i think, unless java divides it by 2 or something
@theend1245: You can't have array within array, but you can create multiple dimension array...Two dimensional arrays (matrix) is defined by two "[ ] [ ]", so it has two indexes, one for row and second for column...
@MrMelonBread if the class average is 56% thats not a good teacher, never helps anyone, never stays after class, never answers questions, never does examples, at the risk of sounding redundant my teacher SUCKED!;p
@283518 What I meant was that he must have good enough to get the jopb, and also note that just cause your class average is low does not mean it is the teacher fault, hell my Programming class' average was in the 60s yet we had a great teacher.
@MrMelonBread lol im not sayin all teachers are bad, my java prof this semester was the shizzle as the kids say lol, but ther are good teachers and bad teachers and im tellin u, my old teacher was horrible, how is anyone supposed to get good marks if a teacher marks on how he feels, one day happy, next day pissed, there are such things as bad teacher is wat im sayin
GUI question... I have a textfield, and an 'enter' button, I need the value of the textfield to be entered into an array[ ].. each time the button is pressed i need the new value stored in the next [index] ... I can't figure out how to do this.. can anyone Help??
I got a problem plz help this is my program: class Avax{ public static void main(String[] args){ int Milan[]={1,2,3,4,5}; int sum=0; for(int counter=0;counter<=Milan.length;counter++){ sum+=Milan[counter]; } System.out.println("The sum of array is "+ sum); } } Output in my console is: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 5 at Avax.main(Avax.java:7) Ive done all like you but still theres a problem plz help
yeah they're called multidimensional arrays and they're defined as " var array [ ][ ]" (var can be any type you want, even a class ). Basically the same syntax as C and C++
I'm having difficulty understanding why one can't simply output ..."The sum of these numbers is " sum); Why all of the sudden, after appending the sum+=bucky[counter];, do you have to use +sum?
Lennybird91 2 days ago
@Lennybird91 It does seem a bit odd to have to use a '+' before sum, but the fact remains that no matter what you pack on other than the initial "The sum of ____ is", will need one. So when you think about it, you still are adding -in a sense- to the rest of the println. Hope that helps... Somehow.
Insomniac10102 2 days ago in playlist Java (Beginner) Programming Tutorials
People always comment on how the views go down with each video. They aren't really going down any more but you can see from the comments that most people are watching for college or uni
TheViolinCalamity 1 week ago in playlist Java (Beginner) Programming Tutorials
@TheViolinCalamity look at the playlist. it gets down to like 45k people. and once it was in the 30s. but i have to agree with most people that stay. this guy is the best!
FewCode 1 week ago in playlist Java (Beginner) Programming Tutorials
How do you sum the elements of a multidimensional array?
RiaAndPreetiAntics 1 week ago in playlist Java (Beginner) Programming Tutorials
@RiaAndPreetiAntics You could use nested for loops, one dimension inside of the other.
TheBlackDeath3 4 days ago
best tutorials in youtube ever..really love you man
TheDemonStr 2 weeks ago
Thank you Bucky! If there wasn't your tutorials I would have never passed my Java-course! :)
Dens1tyE 2 weeks ago
ever seen a class of 120167 students?? :PP
COD5252 3 weeks ago 2
Grammer Nazi Mode Activated:
For multiples of something its "are" not "is" =(
BigRunescapeBrain 3 weeks ago in playlist Java (Beginner) Programming Tutorials
@BigRunescapeBrain Counter-Grammar-Nazi-Activated: It's "it's," not "its" when not discussing possession. ;-)
As for what you pointed out, we fall into vague territory. Considering words such as "team" or "group" when in unison are both still singular, one might question whether the "sum" is behaving as singular. This of course depends, as I've neglected to remember the importance prepositional phrases ("of these numbers") when noting the plurality of the verb. Doh.
Lennybird91 2 days ago
I missread summoning elements of arrays, and I was like =D
MrChearlie2 3 weeks ago
My class is more like "linkedlist. You make data and a pointer. Simple, right? Make one."
6dark6alex6 3 weeks ago in playlist TheNewBoston Java Playlist
How do i save the variable as a matrix, and NOT a single integer?
Ayplus 1 month ago
u awesome,i am watching your sql as well. i am an amateur to programming but u make it so easy.
deepamela1 1 month ago
are you sick or tired or hungover on this vid? :))
asztal911 1 month ago
Hey bucky, i really need help with this/ if anyone else knows.
I am building a calculators using arrays and embedded ifs but i am trying to create an array to store functions like */-+ and i can't seem to work out the syntax for symbol (reply with answer or if you don't understand my meaning).
caseyguitarist 1 month ago in playlist Java Programming Tutorials
@caseyguitarist you can't store operaters into variables if that's what you're trying to do. i would just make a switch statement prompting each function (add, multiply, divide, etc...). idk if that's what your asking but my beginner brain tells me to do that.......
FusionGTZ 4 weeks ago in playlist Java Programming Tutorials
@FusionGTZ i have no fucking idea how i overlooked that
caseyguitarist 4 weeks ago
@SimKessy
You shouldn't have gotten the same result, "sum+=bucky[counter]" would look for the number in the array counter is, so if counter was 0 the number in the array would be 21, etc.. Then it would add the array numbers. In "sum+=counter" it would just add the counter numbers, so you should get a number like 5 or 6 or something.
PhireBoltGaming 1 month ago in playlist More videos from thenewboston
Thanks Bucky. Keep up the good work.
KaiserSanaga 1 month ago in playlist More videos from thenewboston
I wrote out line 7 like this "sum+=counter;" and came to the same result. I don't understand why its written as "sum+=bucky[counter]"
SimKessy 1 month ago in playlist Java Programming Tutorials
theze. lol
t4techy 1 month ago
Why are arrays useful? Where will I put it on a Java game?
fortawesomm 2 months ago
@fortawesomm I made a little text based blackjack game in c++ that I never finished. Now imagine all the cards and suits. You would have to make like 52 variables for each different card. Instead, you can just make 2 array.
cards[] = {ace, two, three, four, five, six, sever, eight, nine, ten, jack, queen, king}
suits[] = {spades, clubs, diamonds, hearts}
Now you just go cards[4] + suits[3], to get the five of hearts. Although this is probably a bad example,it shows what arrays can be used for
ilikemykebab 2 months ago in playlist More videos from thenewboston 2
@ilikemykebab pretty cool.
fortawesomm 2 months ago
@fortawesomm when you start to make games, you will have to make a different variable for every pixel showed in the frame, in that case, if you have like 800 by 640 pixels, that would suck to make that many variables. instead you will use arrays. but you will actually be making multi dimensional arrays. which you will learn later if you keep watching these videos.
bdbbdb2727 1 month ago in playlist Java Programming Tutorials
Thanks for the help guys!
forexdragon 2 months ago
Comment removed
gatoo23 2 months ago
Comment removed
gatoo23 2 months ago
Why am I getting a "counter cannot be resolved to a variable" error on line 11? I copied the code exactly and re-did it 3 times.
forexdragon 2 months ago
@forexdragon Instead of using counter i did this "for (int i=0;i<age.length;i++){ sum += age[i];
}"
Claymore2408 2 months ago
@forexdragon This sounds like when you initilize counter at for( int counter = 0; you are missing int.
shipmaster4000 2 months ago in playlist Java Programming Tutorials
@forexdragon You have mis-typed your code, here is what it should look like:
for (int counter =0; counter<bucky.length; counter++){ total+=bucky[counter]; }
Mrcomtech11 2 months ago
LOL i did totally random numbers and i got 146. 1 away
CodeSensitive 2 months ago
AWESOME...ur much better than my stupid teacher xD
nutjobdude 2 months ago in playlist Java Programming Tutorials
Which Variable could I use if I want text strings in the array?
PeacedDollar 3 months ago
what does += do?
ChrisTheBest1992 3 months ago
@ChrisTheBest1992 it adds on to whatever was previously saved to that value. say you initialised an integer sum = 2; if you were to do something lile 'sum += sum + 1' and output sum you would get 5. This is because it acts as 5 + (2+1). Hope that helps.
mnyambu 3 months ago
@ChrisTheBest1992 It's a shorthand for writing the following.
Num1 = num1 + num2
That's the same as:
Num1 += num2
ChannelSpectrum 3 months ago in playlist Java Programming Tutorials
System.out.printf("The sum of theze numberz iz %d .", sum);
%d is the identifier for numbers. sum replaced %d when printed out.
lucentwish 3 months ago in playlist More videos from thenewboston
when bucky says, "'sup guys this is bucky" he sounds like one of the goth kids from south park. lol
joeygrindsgears 3 months ago
click ads to donate to bucky!
theXminecrafter 3 months ago
How do i get a period (".") right behind the number (147) in the output?
it would work with
System.out.print("The sum of these numbers is " +sum);
System.out.print(".");
but there has to be a more elegant way, right?
TheCarmacon 4 months ago
@TheCarmacon System.out.print("The sum of these numbers is " +sum+".");
JKTCGMV13 4 months ago in playlist More videos from thenewboston
@JKTCGMV13 thanks a lot, mate :)
TheCarmacon 4 months ago
what does += do?
WorldBuildings 5 months ago in playlist Java Programming Tutorials
@WorldBuildings
"sum+= bucky" is the same like "sum= sum + bucky" ;D
19HiLLe94 4 months ago
@WorldBuildings it adds the ammount u choose, for example x +=5 <--- this will add 5 to the current value of X.
you can also do -= which will subtract that ammount
13kmakarenko 4 months ago
write syso and press CTRL + SPACE to get System.out.println();
theXminecrafter 5 months ago
@theXminecrafter i love u
Wazzup800 5 months ago in playlist Java Programming Tutorials
This has been flagged as spam show
@theXminecrafter i love u
Wazzup800 5 months ago in playlist Java Programming Tutorials
starting to get confusing..
sublimeftw2 5 months ago
I subscribed.
EpicnessPivotMaster 6 months ago
IM NOT SUBSCRIBING BUT THANK YOU
youaresosolame 6 months ago
2 days ago a was a 22 years old university student that was studying computer engineering and tried to cheat my Java exams. After im done with these tutorials my teacher is going to cheat so she can give me less points in the upcoming exams.
MusicRevelance 6 months ago 8
THESE , not THEZE
RASHTG 6 months ago
@RASHTG someone has no sense of humor
RazorSRaider 5 months ago
@RazorSRaider HAHA. I figured it out later.
RASHTG 5 months ago
I didnt completely get the video b4 this one until i watch this video
dtgonzalez1 6 months ago
THX MAN!!!! :D Finnaly i finníshed this :) Added some good stuffs :) Now the program will typ out all the Numbers like this "Numbers: 21,16,86,21,3"
And on the next line it will print out the sum of those numbers like this "The sum of these number is 147" And on the third line it will tell the avagre of them :) Like this "The avagre of those numbers is 29" :D I have been watching your videos all day :) So i have been total watched 29 of your videos now :) And i'm learning alll the time!
Playsim1234 7 months ago 2
theze ftw
zerohourkevin 7 months ago 3
For anyone who wants it as a while loop int sum=0;
int counter=0; while(counter<bucky.length) { sum+=bucky[counter];
counter++;
}
FullOfJavaBeans 7 months ago in playlist thenewboston Java Tutorials
OH MY GOSH!!! I WAS JUST TYPING RANDOM NUMBERS IN AND I ACTUALLY TYPED THE EXACT SAME NUMBERS AND SAME AMOUNT OF NUMBERS!
anthropamorphic 7 months ago 2
@anthropamorphic OMGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG. lol
theMRVproject 7 months ago
In my programming class, the teacher will try to teach a lesson, i wont get it, come home, watch your video, and understand it completely <3
JankMonkey 7 months ago 50
@JankMonkey lol same with me. just spent hours trying to figure something out. found my answer here... THANKS BUCKY. YOU ROCK!!!
D33P3 3 weeks ago
@JankMonkey The university should just fire the teacher and put you in a room and turn on these tutorials. xD
kagamers 1 week ago in playlist More videos from thenewboston
u r the best--->bucky
SkysSniper 9 months ago in playlist Java Programming Tutorials
it gives me This message: "Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 5
at apples.main(apples.java:11)
Help please!!
RaymundoGabriel 9 months ago
@RaymundoGabriel, check if you have proper capitalization and use ; at the end of everything.
HeteroProductions 9 months ago
@HeteroProductions Thanks
it help
RaymundoGabriel 9 months ago
@RaymundoGabriel
No problem :)
HeteroProductions 9 months ago
@RaymundoGabriel Looks like you are doing counter<=bucky.length instead of counter<bucky.length
Blinxkitty 8 months ago
@Blinxkitty Thank you , Hello Form Mexico City (i live here)
RaymundoGabriel 8 months ago
You are so good that my teacher just shows your tutorials to my class as her lesson.
DexManley0 11 months ago 239
@DexManley0 So did my teacher also. All the members of my class is watching bucky.
UltimateComputer 8 months ago
@DexManley0 lol :D
Babelfish112 8 months ago
@DexManley0 Lucky you... I wish there were java lessons in seventh grade............ xD
sporreking 4 months ago in playlist java programming from 'the new boston'
@sporreking That would be awesome! I wonder why have the people that start programming are around my age(12). Is it just for games? simply because of minecraft? haha
ziodice 4 months ago
@DexManley0 Stop gloating :(
daymond12345 2 months ago in playlist Java Programming Tutorials
@DexManley0 u serious!?
2yung4grey 2 months ago
@DexManley0 yea my teacher did the same thing which then made me not want to come to class... bad teacher but BUCKy is the best
blkbearh2o 2 weeks ago in playlist Java (Beginner) Programming Tutorials
This has been flagged as spam show
If you are reading this then congratulations on being able to read.
wesiem1993 11 months ago
public class apples{ public static void main(String[] args) { int kyte[]={32,45,56,78,90}; int sum=0; for(int counter=0;counter<kyte.length;counter++);{ sum+=kyte[counter]; } System.out.println("the sum of these numbers is 147" +sum); }
}
IT KEEPS SAYING THE COUNTER IN THE SQUARE BRACKETS IS AN ERROR :(
kyte95 11 months ago
@kyte95 because there's a semicolon after the for loop condition ..
public class apples{ public static void main(String[] args) { int kyte[]={32,45,56,78,90}; int sum=0; for(int counter=0;counter<kyte.length;counter++){ sum+=kyte[counter]; } System.out.println("the sum of these numbers is " +sum); }
}
MrBushxd 11 months ago
@kyte95
take the ; out after your for loop before the { sum+=kyte[counter];}
jls4592 10 months ago
@kyte95 Have you found the answer on this Kyte?
MariaDelMedico 8 months ago
Who's got 6 bullets?
I0met0him 11 months ago
..and in case you want to know how many numbers you have in your array:
public class LearnJava{ public static void main(String args[]){ int num[] = {10, 20, 30, 40, 50}; int counter=0; while(counter<num.length){ counter++; } System.out.printf("The array contains " + counter + " numbers!"); }
}
kymykaly 11 months ago
thank you
demet143 1 year ago
i decided to try and get a average and just did +sum / number of objects and changed int to double. Worked well!
MrJoshiemoto 1 year ago
System.out.println(sum/bucky.length);
For the average
MultiSuperZenful 1 year ago
This has been flagged as spam show
bucky what about adding something to the array or deleting something from it should we use search ?!! like for example
public boolean addNbChildren(String name, int nbch){ int index = this.searchIndexOfEmployee(naa); if(index !=-1){ NbChildren[index]=nbch; return true; } return false; } tell as about adding and deleting in array if you may thanks ..
TheMugiwra 1 year ago
This has been flagged as spam show
bucky what about adding something to the array or deleting something from it should we use search ?!! like for example
public boolean addNbChildren(String name, int nbch){ int index = this.searchIndexOfEmployee(naa); if(index !=-1){ NbChildren[index]=nbch; return true; } return false; } tell as about adding and deleting in array if you may thanks ..
TheMugiwra 1 year ago
This has been flagged as spam show
bucky what about adding something to the array or deleting something from it should we use search ?!! like for example
public boolean addNbChildren(String name, int nbch){ int index = this.searchIndexOfEmployee(naa); if(index !=-1){ NbChildren[index]=nbch; return true; } return false; } tell as about adding and deleting in array if you may thanks ..
TheMugiwra 1 year ago
Comment removed
TheMugiwra 1 year ago
theze tutorials are good.
PinoyPsychoPath 1 year ago
If your arrays are ages and you want to find the average age, use this
System.out.println("The average age is " + sum/bucky.length);
Works no matter how many arrays you got.
smil8888 1 year ago
This has been flagged as spam show
Use this
System.out.println("The average age is " + sum/bucky.length);
If your array is ages, and if you want the average age.
This works no matter how many arrays.
smil8888 1 year ago
Comment removed
smil8888 1 year ago
Yo dawg, I heard you like arrays, so we put an array in yo array so you can initialize while you initialize!
JumpInFlames 1 year ago 4
They are called multidimensional arrays.
MultiProNoob 1 year ago
A tip for this sort of thing.
If you think there's any chance you could be summing a large array, or one with large int values, you may want to make your sum variable to be of type long to prevent overflow. A long is the same is an int but can store a much bigger range of values.
jemsut 1 year ago
You are very good with the Java language. Not so much the English language :P
ravensrock86 1 year ago
@ravensrock86 lol
tdude179 1 year ago
ack... I find too many praises here... :)
ThePhoenixRider 1 year ago
@peeyam , actually if you do as bucky does your array will be like bucky[0] bucky [1] ... bucky[4] , but if you add "=" , it will get one more value , but since array content only five values , bucky[5] doesn't exist.And you are out of 0,1,...,4 index.
MrKrabbs2009 1 year ago
shouldn't line 7 have "counter<=bucky.length"??? I know it works, but when it gets to bucky[5].. it shouldn't add the "3" to it... and if I put the "=" sign in.. I get an error "Exception in thread "main" java.lang.ArrayIndexoutOfBoundsException: 5 at apples.main(apples.java.:8)
peeyam 1 year ago
im geetin this error message Exception in thread "main" java.lang.Error: Unresolved compilation problem: counter cannot be resolved to a variable at apples.main(apples.java:7)
hammadkhalid 1 year ago
Your tutorials are MY PRECIOUS!
Zorobay 1 year ago 2
sum+=bucky[counter];
Does java temporally store the total sum in [counter]?
Thanks in advance.
TorresGerrard91 1 year ago
Comment removed
TorresGerrard91 1 year ago
hey bucky what if all numbers that i want to add is in a variable? and what if the array length is based on what the user will input in another variable? hope u get wat i want to do! pls help
prue0210 1 year ago
BTW gaiz, if you add a sum=sum/bucky.length; and then output it on the screen you can get the array average, i think, unless java divides it by 2 or something
ro33han 1 year ago
omg genius!
moez507 1 year ago
Hmm in php you can just do array_sum($array) and it will add the whole thing without doing a loop... wonder if java has an equivalent function...
after731 1 year ago
@after731 If not, you could always create your own class to do it much faster.
mpm1900 1 year ago
@after731 Google may have you answer
MrMelonBread 1 year ago
@theend1245: You can't have array within array, but you can create multiple dimension array...Two dimensional arrays (matrix) is defined by two "[ ] [ ]", so it has two indexes, one for row and second for column...
omgffsmlladen 1 year ago
you are great man
you are very very very claver thank you very match
oday zahde
palestine - hebron
odayzahde 1 year ago
how do you make an array of words, instead of numbers?
4thKyuubi 1 year ago
@4thKyuubi
String
angelbeltre2050 1 year ago
@4thKyuubi <_< Use The String Variable Instead of Int
MrMelonBread 1 year ago
Comment removed
4thKyuubi 1 year ago
my java teacher sux, i always come here if i dont understand something;p
283518 1 year ago
@283518 Obviously not or else he would not have gotten hired, why blame the teacher because "you don't get it"
MrMelonBread 1 year ago
@MrMelonBread if the class average is 56% thats not a good teacher, never helps anyone, never stays after class, never answers questions, never does examples, at the risk of sounding redundant my teacher SUCKED!;p
283518 1 year ago
@MrMelonBread btw the first part of ur comment to me doesnt make sense,lol jst thought ud like to know;p
283518 1 year ago
@283518 What I meant was that he must have good enough to get the jopb, and also note that just cause your class average is low does not mean it is the teacher fault, hell my Programming class' average was in the 60s yet we had a great teacher.
MrMelonBread 1 year ago
@MrMelonBread lol im not sayin all teachers are bad, my java prof this semester was the shizzle as the kids say lol, but ther are good teachers and bad teachers and im tellin u, my old teacher was horrible, how is anyone supposed to get good marks if a teacher marks on how he feels, one day happy, next day pissed, there are such things as bad teacher is wat im sayin
283518 1 year ago 2
@MrMelonBread That means your class was retarded then.
mayhempk1 1 year ago
@mayhempk1 I agreed, that was my point. It is more about the student than it is the teacher
MrMelonBread 1 year ago
i thought he was gonna say "theze nuts".
Saladon89 1 year ago
what about this?
double var;
var=6*Math.random();
var=Math.floor(var++);
System.out.println(var);
btw Math.random() gives a number from 0 to 0.999999999...
johnvbs 1 year ago
GUI question... I have a textfield, and an 'enter' button, I need the value of the textfield to be entered into an array[ ].. each time the button is pressed i need the new value stored in the next [index] ... I can't figure out how to do this.. can anyone Help??
BTW... your tuts are awesome!
Jdub1581 1 year ago
THANKS FOR THE VID!!!!
ylikdisss 1 year ago
I didn't know you took requests. I'll take a Grey Goose Vodka Martini with one olive.
Fbiman93 1 year ago
hi,
great video by the way :)... just a quick question, why do you need to increment he counter variable?
Thanks!
MrJSmithify 1 year ago
@MrJSmithify if you dont you would be stuck in the for loop forever :O
RUBENKNEX 1 year ago
omg sry for spam browser was bugged so i clicked like milion of times on "post" sry :@ :S
Tijosav 1 year ago
Comment removed
Tijosav 1 year ago
Comment removed
Tijosav 1 year ago
This has been flagged as spam show
Tijosav 1 year ago
@Tijosav dude, just remove the equal sign from the counter<=Milan.length and run it. i encounter that problem to right now
darthoni16 1 year ago
Comment removed
Tijosav 1 year ago
Comment removed
Tijosav 1 year ago
Comment removed
Tijosav 1 year ago
Comment removed
Tijosav 1 year ago
Comment removed
Tijosav 1 year ago
Comment removed
Tijosav 1 year ago
Comment removed
Tijosav 1 year ago
Comment removed
Tijosav 1 year ago
This has been flagged as spam show
come on man , come with muture example next time when you come , hopfully seee u again with some muture example then....
hmk25061984 2 years ago
Comment removed
theend1245 2 years ago 28
Of course, programmers do so all the time.
First, create the array you want (for example, int[] bucky). Now add another pair of square brackets (int[][] bucky).
There you go.
SweedRaver 2 years ago
yes, it would be a two dimentional array then, if you add more to that, it would be three dimentional, etc.
iRsAllNight 2 years ago
Sure, but what would be the point? It would be like having a table inside the cell of a bigger table
brechtjah 2 years ago
@theend1245
what you want, is a Multidimensional Array.
the tutorial 33 is about that
natansbo 2 years ago
its possible with linked lists
enposteral 1 year ago
@theend1245 i think it can be done .. but i never did it before
BadMadB0y 1 year ago
@BadMadB0y of course it can be done, its called a matrix or 2 dimensional array, like int myArray[3][3]={
1,2,3,
4,5,6,
7,8,9};
myArray[1][2] = 6
RUBENKNEX 1 year ago
@theend1245
2dimensional arrays
FIFA10Vid 1 year ago
@theend1245 check vectors they might do the trick x)
fmc333 1 year ago
@theend1245 You know, if you used Google you would get you answer faster
MrMelonBread 1 year ago
@theend1245 you can write int arraynam[20][20]. Which would create 20x20 array. which means each array has an array of 20.
So you could go: arrayname[0][7] = 2; arrayname[0][4] = 6 arrayname[2][19] = -2;
and so on, you could make even more "dimensions" like.
Like this: int arrayname[20][20][20];
but be careful the memory you are using expands fast.
an int arrayname[20][20][20]; would have to use 32000 bytes of memory.
SammySpeaksUp 1 year ago
@theend1245 You can have a multidimensional array.
mayhempk1 1 year ago
@theend1245
yeah they're called multidimensional arrays and they're defined as " var array [ ][ ]" (var can be any type you want, even a class ). Basically the same syntax as C and C++
Rorschackh 1 year ago 5
@theend1245 See tutorial 33 - Multidimensional Arrays. Also, Rorschackh's comment.
AwkwardSquad 1 year ago
@theend1245
yes u can create arrays in arrays.
just make more brackets like that [ ] [ ]
It is like having drawers in drawers ;-)
Larsfromger 1 year ago
@theend1245 yup it's possible.. it's called a 2-D array..
dotahyper 1 year ago