Are you male or female? (m/f) asdgfdasfdghkfdghfdyugiyftyyyyyyyyyysdzzzzzzhjvnnnnnbmnmnmnmbgfsdfs Response: a Are you male or female? (m/f) asdfffffffgh Response: a Are you male or female? (m/f) sffffffff Response: s Are you male or female? (m/f) f Response: f So i see you are a woman... take 2 Are you male or female? (m/f) dasdklasldk Response: d Are you male or female? (m/f) male Response: m So you are a man...
and then a little bit more but youtube wont let me paste it.
if you have trouble with scanner letter input to a managable variable ask meh :D this example is a male female prompt that never ends till you type wither m or f.. or any word begining with m or f. dosent matter. here is an example
public class genderdatatest { public static void main(String[] args){ Scanner input = new Scanner(System.in); String finish = "no"; char genderdata = 'n'; do{ System.out.println("Are you male or female? (m/f)"); genderdata = input.nextLine().charAt(0); System.out.println("Response: "+ genderdata); if(genderdata == 'm'){ finish = "yes"; System.out.println("So you are a man...");
I have been following these lessons over the weekend and I gotta say you are great, I tried learning java a few months back but stopped as it seemed kinda hard, but you nail it!
I know these vids are years old, but still, I felt I had to express my gratitude.
Hi, I got a question: why we can't type "for(int y:x)" but "for(int y:bucky)"? I thought we already transferred the array from bucky[] to x[] at the third paragraph. I tried "for(int y:x)" at home and it showed error.
@yaazimti there's a lot of different sorting algorithms, you can google "sorting algorithms". The easier one (easy bcuz it's the only one actually understand) for me to implement is called "counting sort": wiki -> Algorithm_Implementation/Sorting/Counting_sort
I mean if I have A[][] and B[][] and I invoke x() method and gave two arguments to that x() method...the arguments for the x() method should be for example xx[][],yy[][] .... but the return how should I return that and use it in the main method ?
Optimization... thank for everything though, i need to learn the syntax of java it differs a bit from the languages i know already and i need to learn it for my course so this helps me alot.
also when you copy and paste you can just use the key combinations you don't have to use the selection menu (from one lazy person to another)
Hey all. Anyone know how to get a program to only allow one response if the user inputs a certain keyword. This isnt right but its what ive been using...
String A12A="Epona";
System.out.println("\nSPELT CORRECTLY, what is the name of Link's Horse in O.O.T.? "); String A12=in.toString();
Had to watch it twice, but finally got the logic. Even then, I wouldn't worry about it to much, just keep grinding on it. I write a little code a day to bake it all in. Its working.
The only part I dont get about this, is how the statement changes the array bucky since there is no return statement. Its a void function- so how does it pass the values back to the main method.
@KawallaBair even when void the method can still alter information within the class. the return statement is only data displayed back to the user.........does that help?
Maybe I'm getting too far ahead of myself here, but I tried doing the same thing again and created another change (named changealso), and did y[counter]+=10;
I wanted to print one the first change, then print out the 2nd after adding 10 more on another line. (Like the Index\tTable) we did back a few episodes ago)
@zaeroxe It is called an enhanced for-loop. Enhanced for loops are pretty much used for shorthand in use in conjunction with arrays. What an enhanced for-loop does is this:
1.It takes an arbitrary integer and sets it to 0 (Bucky used int y for this)
2.It then takes an array you want to iterate (Bucky used Bucky[] for this)
SO we have for(int y:bucky[])
3. it then starts at zero and iterates up from 0 to the end of the array, and since bucky told it to print out; it will then print out for
@zaeroxe its taking the contence of the array and storing them in x as and integer (int), the bucky bit is telling the loop from which array to gather the information
@skkk90 The reason he marks the value as void is because it is not returning a value; rather changing a value. These are called "mutators" in java. The mutator merely alters the values within the array; no return type is necessary since a simple calculation and alteration is performed.
Thanks for pointing out that this tutorial is actually about ITERATORS Kachoosi.
Bucky why can't you mention to people that what we are actually dealing with is ITERATORS? I think you miss out stuff sometimes for the sake of simplicity.
the only thing i can't understand is how the change method actually changes the bucky array. From my limited knowledge, the method created a separate copy of the bucky array, and named it x. Somehow java recognizes the x array the same as the bucky array, and when he tells it to print out bucky, even though he only changed the separate x array, it also changed bucky. Are the parameters you pass into a method somehow linked to it outcome?
@amydfu its the same thing, dont worry. You remember the first time we allocated an array dynamically ? we typed int bla[] = new int[10]; , where u actually have the syntax u used.
for(int y : bucky)...I don't get the 'int y' variable.. the for statement is meant to read "for every integer data type of the name y in bucky print it out". Well you haven't even initialized or defined what 'y' is so how can you print it out?
@forexdragon y is actually an iterrator. it iterrates thru the array and takes the value of the current array element starting at index=0 and running until index=array.length . example: you have an array called Test[3] with 3 values Test[0] = 4 Test[1] = 3 Test[2] = 10 if youd write now: for(int x: Test) { System.out.println(x+", "); } it'd output: 4, 3, 10 its the same as for(int i=0; i<Test.length; i++) { System.out.println(Test[i]+ ", "); } but shorter. hope this helped
Lol @ tuna.java...I love tuna :D, brilliant videos btw, very helpful. I've learnt in 10 mins what my teacher tries to teach in 2 hours, not that he doesn't make sense..just takes too long.
THERE'S NO SCOPE AND VISIBILITY IN JAVA!!! I'm coming from c++ and I am in programming heaven right now! No scope! That means no pointers, no refrences! YYYES!!!
I totally agree. Everything is getting more and more complex. Everything is interchangeable with everything else. Parameters are no longer just simple variables, but they can be arrays or objects or God knows what else and the same with types...not only just data types, they too can be objects/classes and arrays etc... Too bad you need to learn java to make money cuz it blows. I do not agree that learning a programming language is the same as learning a spoken one.
Let us never forget that logic does not necessarily imply simplicity or common sense, certainly in the case of java. How logical is it that when you 'assign' or declare a value to a variable, sometimes you read from left to right and other times right to left? Example: int x=0; is read left to right and yet x=x+1 is read right to left? Is it because of math calculation involved you go from right to left? Nobody has ever explained this to me.
Can somebody explain how are the arrays returned from a method if it is needed? i mean, instead of void in the method declaration, should there be an int [] or something like that?
@redjr242 arrays are just a way to store multiple variables of the same value into one variable, so instead of making bucky1, bucky2, bucky3.... bucky2000, you just make bucky[], and it can store values from 0 to 1999. the for loop is just a way to go through the array modifying each number it has, when you put the counter inside the brackets, you are refering to a position on the array. i think you should make sure you understand everything well before going further on the tutorials.
@Xeinnex1 yes, I understand that, it's just certain things he types, I don't feel like he fully explains why he does type it and I'm just left confused by the end. I appreciate your comment though.
@redjr242 well i like helping people so if you need anything just msg me, also keep in mind all what he types without explaining is because he already explained it before, so you might want to look for it in the past tutorials maybe you missed it :)
@Peldans programming isnt something that you can just pick up and do right away. it takes years of practice just to be somewhat good at it. there are a few who pick it up and run with it, but for the rest of us, weve been studying and practicing. its like baseball, despite how people who have never played it says its easy, it takes practice day after day for a lifetime to catch, throw, and hit like they do in the majors. do as bucky says at the end of his tutorials "play around with it"
@Peldans Im with you i did array list in my programming 1 class and seem to be getting the hang of how arrays right now to some extent but for me the most difficult thing i have is making a actually around it .
Hey when I run the program, I get this error printed: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 8 at apples.main(apples.java:8)
@xaxjx88 When he uses the change-method on the array called bucky, then the array called x will have the same numbers and the same length as bucky. And since there are 5 numbers in bucky, the length is 5.
No, you can't use an enchanced for-loop in the change-method.
If you do, you create a variable i, and set its value equal to each number in the array, respectively. When you add 5 to the number i, the numbers in the array will be left unchanged.
That's because i is not the same variable as those numbers. It only has the same value as them.
It's like two people having the same amount of money, then one of them gets 5 more coins.
@frostshadow5 Because computer always starts 0 for first Index instead of 1. For example if the number of arrays is 6, the computer starts from 0,1,2,3,4,5
@frostshadow5 Because counting starts at 0, so an array that has seven things in it (length seven) occupies spaces 0,1,2,3,4,5 and 6, for example. Therefore x[x.length] doesn't exist, only elements up to x[x.length-1] (or counter < x.length), so if counter went up to x.length (counter<= x.length) you would get back an error for trying to access something that doesn't exist. Hope that makes sense :).
Ah sweet I'm doin the same as you. I read ints are NOT assigned pointers so this will only work with arrays because he is manipulating the object through the 'copied' pointer but this is not the case with an int. It's interesting because you can manipulate the copied pointer but not the original. try making a method to take two arrays swap the pointers and then change the object through the swapped pointer. you will change the "other" object. I tried it and it worked so now I understand :)
@matthewdoucette it changed it because x is your array and when it did x[counter]+=5 it added 5 to each one because the counter keeps adding by 1 in the brackets if you still need help email me at mfransen2016@hotmail.com
Hey I am likewise confused but I think it has something to do with the pointers used. Apparently the "pointer" or "reference" is passed by value so if you do a data manipulation using the pointer it will change the object. I hope that makes sense, I'm not very good at explaining but pointers are quite a good computing concept to have so just reply to this if you want me to go through that. But interestingly enough try the code without an array and just an int. It WONT change the object. WHY?
@matthewdoucette Hey I am likewise confused but I think it has something to do with the pointers used. Apparently the "pointer" or "reference" is passed by value so if you do a data manipulation using the pointer it will change the object. I hope that makes sense, I'm not very good at explaining but pointers are quite a good computing concept to have so just reply to this if you want me to go through that. But interestingly enough try the code without an array and just an int. It WONT change.
@Ubercool29 I am well versed in C++ and pointers and all of this, and passing by value and reference. So really I just need to know whatever rules are followed in Java and then memorize them, as I understand the concepts perfectly. So, I guess, my real wonder was why is the rule different for a variable and an array? I'm not sure, but, as you said, it's obvious the array is passed in via its pointer (likely as by value but it doesn't matter) and variables are not. Thanks for replying!
bucky this is serious, please create a video tutorials for sale! with more and more examples etc... I study programming and I understand you more from you that my asshole teacher
maybe do it with lynda dot com? I can pay for more of your tutorials
oh nevermind. Why can't this method exist within the main method? That's why I was getting an error. It has to be outside of the main method....I guess that makes sense...
@rustondust notice he didn't put a semi colon at the end of the for line. That means the program will execute the next block of code for x times. since he is only using one line of code after his for loop, brackets aren't necissary
How did the script know bucky = int x when you made the change class? Because the change class have an empty array called x that adds to 5 everytime in a for counter loop and then Bucky is called into this one and the change class automatically sets the empty array int x to bucky??
I thought you had to declare it, or am I totally lost?
@asdFRap because when you add 5, your only changing the variable holding the numbers, and not the array itself. for example the integer "i" was only holding the values of the array, and is not the array itself, so when you change the "i" value... your not even changing the array at all
Why doesn't an enhanced for loop work in the change method? The values don't change. If I want to print the changed values, I have to print from within the change() method.
private static void change(int x[]) { for (int counter:x){ counter += 5; System.out.println(counter); //this will print the new value }
good job. Is there a video you have on here that would teach me how to modify the array program so it takes inputs of digits from the keyboard and displays which digits is missing?
dragonthewatcher 17 hours ago
and then a little bit more but youtube wont let me paste it.
if you have trouble with scanner letter input to a managable variable ask meh :D this example is a male female prompt that never ends till you type wither m or f.. or any word begining with m or f. dosent matter. here is an example
dragonthewatcher 17 hours ago
import java.util.Scanner;
public class genderdatatest { public static void main(String[] args){ Scanner input = new Scanner(System.in); String finish = "no"; char genderdata = 'n'; do{ System.out.println("Are you male or female? (m/f)"); genderdata = input.nextLine().charAt(0); System.out.println("Response: "+ genderdata); if(genderdata == 'm'){ finish = "yes"; System.out.println("So you are a man...");
dragonthewatcher 17 hours ago
i finnaly fixed my java problem
answer=
dragonthewatcher 17 hours ago
Wait I'm a bit confused. How did the "x" in the change method edit the bucky string. I thought they would be apart?
SSHPCS2 1 day ago in playlist Java (Beginner) Programming Tutorials
Ive got a sugestion, make a compelation file that kan be downloaded (prevrably torrent) so that we kan keep it as a manual
moadiep1 2 days ago in playlist Java (Beginner) Programming Tutorials
I see that x is bucky but how became bucky same as x
gustavboll1 3 days ago
Hey Bucky :D
I have been following these lessons over the weekend and I gotta say you are great, I tried learning java a few months back but stopped as it seemed kinda hard, but you nail it!
I know these vids are years old, but still, I felt I had to express my gratitude.
Thanks alot man!
1986dannytboi 3 days ago in playlist Java (Beginner) Programming Tutorials 2
Can a method return an array by any chance?
dodexodus 6 days ago in playlist Java (Beginner) Programming Tutorials
This has been flagged as spam show
Hi, I got a question: why we can't type "for(int y:x)" but "for(int y:bucky)"? I thought we already transferred the array from bucky[] to x[] at the third paragraph. I tried "for(int y:x)" at home and it showed error.
Thanks!
ffggtt30256 1 week ago in playlist Java (Beginner) Programming Tutorials
Comment removed
ffggtt30256 1 week ago
Does anyone actually need to get good at it?
Like I know everything you have said ^-^
Anyways,
Never gonna give you up,
never gonna let you down!
Chillers1337 1 week ago in playlist Java (Beginner) Programming Tutorials
Must not give up... o.O
TheTinkletron 1 week ago in playlist Java (Beginner) Programming Tutorials 20
how to Input a list of numbers and sort it in ascending order???
yaazimti 2 weeks ago
@yaazimti there's a lot of different sorting algorithms, you can google "sorting algorithms". The easier one (easy bcuz it's the only one actually understand) for me to implement is called "counting sort": wiki -> Algorithm_Implementation/Sorting/Counting_sort
HugTears 2 weeks ago
next 3 tutorials are for arrays too
XxxTheProGamerzxxX 3 weeks ago in playlist Java (Beginner) Programming Tutorials 6
I mean if I have A[][] and B[][] and I invoke x() method and gave two arguments to that x() method...the arguments for the x() method should be for example xx[][],yy[][] .... but the return how should I return that and use it in the main method ?
altarazisultan 3 weeks ago in playlist Java (Beginner) Programming Tutorials
Guys, this video for invoking one array 1D...how about if I want to return two diminutional array after I invoked them in the main method().
altarazisultan 3 weeks ago in playlist Java (Beginner) Programming Tutorials
@thenewbostom y u no just
for(int y: bucky);
y+=1;
System.out.println(y);
Optimization... thank for everything though, i need to learn the syntax of java it differs a bit from the languages i know already and i need to learn it for my course so this helps me alot.
also when you copy and paste you can just use the key combinations you don't have to use the selection menu (from one lazy person to another)
Imperceivable 3 weeks ago in playlist Java Programming Tutorials
This has been flagged as spam show
Hey all. Anyone know how to get a program to only allow one response if the user inputs a certain keyword. This isnt right but its what ive been using...
String A12A="Epona";
System.out.println("\nSPELT CORRECTLY, what is the name of Link's Horse in O.O.T.? "); String A12=in.toString();
A12 = in.nextLine();
if (A12 == A12A)
{
points++; System.out.println("Correct!"); }
else
System.out.println("Sorry, WRONG!");
Bobmcd0 3 weeks ago in playlist Java Programming Tutorials
Comment removed
Bobmcd0 3 weeks ago in playlist Java Programming Tutorials
Shouldn't there be a return statement in the method?
Lucke189 1 month ago
@Lucke189
The method itself is not returning anything. It is just taking the array and editing the values. At least that's what I think is happening.
BlueSogekihei 1 month ago in playlist Java Programming Tutorials
Comment removed
elizaki18nafplio 1 month ago
hey yo... thanx for the new for loop..... i hope i will be able to use it.... :)
funkenn 1 month ago
Had to watch it twice, but finally got the logic. Even then, I wouldn't worry about it to much, just keep grinding on it. I write a little code a day to bake it all in. Its working.
trueredexe 1 month ago
The only part I dont get about this, is how the statement changes the array bucky since there is no return statement. Its a void function- so how does it pass the values back to the main method.
KawallaBair 1 month ago in playlist Java Programming Tutorials
@KawallaBair even when void the method can still alter information within the class. the return statement is only data displayed back to the user.........does that help?
sikz26300 1 month ago
I get it, it's just how am I supposed to remember this?
RCPlaneFlyer16 1 month ago in playlist Java Programming Tutorials
Maybe I'm getting too far ahead of myself here, but I tried doing the same thing again and created another change (named changealso), and did y[counter]+=10;
I wanted to print one the first change, then print out the 2nd after adding 10 more on another line. (Like the Index\tTable) we did back a few episodes ago)
.. Here is what I have (minus all the obvious)
--
for(int p: widow) System.out.println(p); for(int w: widow) System.out.println(w);
I know I'm missing something...
falkills 1 month ago in playlist Java Programming Tutorials
And by the way, there is a return after the first print line. not sure why youtube didnt see that
falkills 1 month ago in playlist Java Programming Tutorials
@falkills you're missing another object. Bucky1 and bBucky2 containing the same value.
int[] bucky1 = {};
int[] bucky2 = {};
You are trying to add 5 and 10 at the same time to only one array.Which is impossible without implementing treads.You will learn about threads later.
sesshoumaru3st 1 month ago in playlist Java Programming Tutorials
The only thing I don´t get is the for(int y:bucky)
What is happening here?
zaeroxe 1 month ago
@zaeroxe It is called an enhanced for-loop. Enhanced for loops are pretty much used for shorthand in use in conjunction with arrays. What an enhanced for-loop does is this:
1.It takes an arbitrary integer and sets it to 0 (Bucky used int y for this)
2.It then takes an array you want to iterate (Bucky used Bucky[] for this)
SO we have for(int y:bucky[])
3. it then starts at zero and iterates up from 0 to the end of the array, and since bucky told it to print out; it will then print out for
tjfrisch 1 month ago
@zaeroxe PARTII.
all the values of y that coordinate with the array. For instance; it is shorthand for this for loop:
for(int y = 0, y>bucky[].length, y++)
{
}
Understand? if not contact me.
tjfrisch 1 month ago
@zaeroxe
enhanced for loop
parelpeedikayil 1 month ago in playlist Java Programming Tutorials
@zaeroxe enhanced for loop
parelpeedikayil 1 month ago in playlist Java Programming Tutorials
@zaeroxe its taking the contence of the array and storing them in x as and integer (int), the bucky bit is telling the loop from which array to gather the information
Cobezzz 1 month ago
@Cobezzz as an* integer
Cobezzz 1 month ago
@zaeroxe
Please check out the chapter31, It must help
90158160 4 weeks ago in playlist Java Programming Tutorials
why does he put void, is the method not returning an arrat list of the new values?? And when do you put an array as the return data type?
skkk90 1 month ago
@skkk90 The reason he marks the value as void is because it is not returning a value; rather changing a value. These are called "mutators" in java. The mutator merely alters the values within the array; no return type is necessary since a simple calculation and alteration is performed.
Understand?
If not; contact me.
tjfrisch 1 month ago
Thanks for pointing out that this tutorial is actually about ITERATORS Kachoosi.
Bucky why can't you mention to people that what we are actually dealing with is ITERATORS? I think you miss out stuff sometimes for the sake of simplicity.
forexdragon 1 month ago
I don't think that arrays are hard. I think it's one of the things that makes programming so much easier!
karolyipeti 1 month ago in playlist Java Programming Tutorials
Thanks for getting me unstuck.
iraqtv 1 month ago
public static void main(String [] args){
change(schoolteacher);
}
MrEmil20 1 month ago
What the fuck did he just dooo ugh i wnat to learn java but this is so hard
DCM0Dz 1 month ago
IM SLOWLING GETTING LOST AS FUCK AHHHHH
DCM0Dz 1 month ago
rewinded a million times and finally got it
agcummings11 2 months ago
is the code in the parenthesis for the method called "change" just pre creating a array that can be used by a different method?
agcummings11 2 months ago
Comment removed
xJustas 2 months ago
glad i know most general c++ its helps alot with java arrays. almost identical code
TheHellFrozenOver 2 months ago
the only thing i can't understand is how the change method actually changes the bucky array. From my limited knowledge, the method created a separate copy of the bucky array, and named it x. Somehow java recognizes the x array the same as the bucky array, and when he tells it to print out bucky, even though he only changed the separate x array, it also changed bucky. Are the parameters you pass into a method somehow linked to it outcome?
Gam3r979 2 months ago
@Gam3r979 Yes. The bucky array's values are passed by reference, meaning that changes to x will be applied to the bucky array.
CamdawgzXXX 2 months ago in playlist Java Programming Tutorials
@CamdawgzXXX thank you!
Gam3r979 2 months ago
So... I accidentally typed "public static void change(int[] x)" but it still seems to work.
1) why? and 2) is this a bad thing to do?
amydfu 2 months ago in playlist java
@amydfu its the same thing, dont worry. You remember the first time we allocated an array dynamically ? we typed int bla[] = new int[10]; , where u actually have the syntax u used.
Kaischoosi 2 months ago
Omg guyz as Java gets more complicated, these videos are getting more complicated, and I am so stupid! Guys I'm so stuuupid :(
StPsychic 2 months ago in playlist Java Programming Tutorials
arrays suck and are confusing
MrStropwen 2 months ago
@MrStropwen arrays are immensely useful, and are worth learning. as java gets harder, it gets more useful.
[3][4][5][6][7] 0 1 2 3 4
Janac 2 months ago
for(int y : bucky)...I don't get the 'int y' variable.. the for statement is meant to read "for every integer data type of the name y in bucky print it out". Well you haven't even initialized or defined what 'y' is so how can you print it out?
forexdragon 2 months ago
Kaischoosi 2 months ago
thank you !!
lebzouz 2 months ago
never seen for(int var: something){} looks great
mav89 2 months ago in playlist Java Programming Tutorials
what is that word at 1:29 premedor? pramdor?
what does that mean?
tsigarete 3 months ago
@tsigarete its parameter
eilzandra0023 2 months ago
@eilzandra0023 thank you ;)
tsigarete 2 months ago
Comment removed
eilzandra0023 2 months ago
@tsigarete
Haha. Maybe 'premador' is the Spanish equivalent of the word 'parameter'.
forexdragon 2 months ago
@forexdragon No, the spanish of 'parameter' is 'parametro'.
zVenFTW 2 months ago in playlist Java Programming Tutorials
Lol @ tuna.java...I love tuna :D, brilliant videos btw, very helpful. I've learnt in 10 mins what my teacher tries to teach in 2 hours, not that he doesn't make sense..just takes too long.
TheDivineFortress 3 months ago
arrays is very difficult!
elvisniperx 3 months ago in playlist More videos from thenewboston
What does the Line 6 means? (y:bucky)
MrEmil20 3 months ago
@MrEmil20 Watch the previous tutorial?
sasuke2910 3 months ago in playlist More videos from thenewboston
How could this be useful when programming games? :L
SPlRO 3 months ago in playlist Java Programming Tutorials
@SPlRO Storing information(like item IDs) in an array can be useful.
kaimarohero 3 months ago
DR RABIE RAMADAN EXPLAIN BETTER THAN THIS VIDS
hossamrabat 3 months ago
THERE'S NO SCOPE AND VISIBILITY IN JAVA!!! I'm coming from c++ and I am in programming heaven right now! No scope! That means no pointers, no refrences! YYYES!!!
gogonimago 3 months ago in playlist thenewboston Java
there's 100,000 views but probably on 10,000 viewers replayed x10 because they cant understand. :P
Meanbean1992 4 months ago 24
@Meanbean1992 SCREW YOU ! don't let us down <_<
MonsterKill1985 3 months ago
@Meanbean1992
I totally agree. Everything is getting more and more complex. Everything is interchangeable with everything else. Parameters are no longer just simple variables, but they can be arrays or objects or God knows what else and the same with types...not only just data types, they too can be objects/classes and arrays etc... Too bad you need to learn java to make money cuz it blows. I do not agree that learning a programming language is the same as learning a spoken one.
forexdragon 2 months ago
@Meanbean1992
Let us never forget that logic does not necessarily imply simplicity or common sense, certainly in the case of java. How logical is it that when you 'assign' or declare a value to a variable, sometimes you read from left to right and other times right to left? Example: int x=0; is read left to right and yet x=x+1 is read right to left? Is it because of math calculation involved you go from right to left? Nobody has ever explained this to me.
forexdragon 2 months ago
@forexdragon x=x+1 IS read from left to right. It means, "Add 1 to x and assign the resulting value to x."
rampage241 2 months ago
@Meanbean1992 I understood fine, I'm ten years old.
HTMLMINECRAFTGUYJAVA 1 month ago
@HTMLMINECRAFTGUYJAVA Good 4 ya :P, you dont need to tell your age as java is for everyone who understands. ^^
Decodeish1 1 month ago in playlist Java Programming Tutorials
@Meanbean1992 lolz... true that....
funkenn 1 month ago
instead of counter, he should use i
JKTCGMV13 4 months ago in playlist More videos from thenewboston
Can somebody explain how are the arrays returned from a method if it is needed? i mean, instead of void in the method declaration, should there be an int [] or something like that?
Thanks
andresher01 4 months ago
Am I the only one having trouble understanding arrays? 1-15 was really easy, now it's difficult to understand these tutorials :(
Peldans 4 months ago 34
@Peldans same, i have no idea what he's saying now, I just try to follow along, and when I'm done I'll watch them all over again.
redjr242 4 months ago in playlist Java Programming Tutorials
@redjr242 arrays are just a way to store multiple variables of the same value into one variable, so instead of making bucky1, bucky2, bucky3.... bucky2000, you just make bucky[], and it can store values from 0 to 1999. the for loop is just a way to go through the array modifying each number it has, when you put the counter inside the brackets, you are refering to a position on the array. i think you should make sure you understand everything well before going further on the tutorials.
Xeinnex1 4 months ago
@Xeinnex1 yes, I understand that, it's just certain things he types, I don't feel like he fully explains why he does type it and I'm just left confused by the end. I appreciate your comment though.
redjr242 4 months ago
@redjr242 well i like helping people so if you need anything just msg me, also keep in mind all what he types without explaining is because he already explained it before, so you might want to look for it in the past tutorials maybe you missed it :)
Xeinnex1 4 months ago
@Peldans i thought it was really hard, so i watched all the array tutorials one more time, and now i understand it much better :)
DJafferiK 3 months ago
@Peldans
I am with you friend.
forexdragon 2 months ago
@Peldans
That is java for you. Lesson 1 Hello world. Lesson 20 O.0
yost28 2 months ago
@Peldans yes tell me about it it is getting harder and harder
MrStropwen 2 months ago
@Peldans No u suck
xJustas 2 months ago
@xJustas You mad?
Peldans 2 months ago
@Peldans programming isnt something that you can just pick up and do right away. it takes years of practice just to be somewhat good at it. there are a few who pick it up and run with it, but for the rest of us, weve been studying and practicing. its like baseball, despite how people who have never played it says its easy, it takes practice day after day for a lifetime to catch, throw, and hit like they do in the majors. do as bucky says at the end of his tutorials "play around with it"
53knights 1 month ago in playlist Java Programming Tutorials
@Peldans Im with you i did array list in my programming 1 class and seem to be getting the hang of how arrays right now to some extent but for me the most difficult thing i have is making a actually around it .
darkpalatin 1 month ago
@Peldans Wow lol i am 13 and i have no trouble with this. I am i did have a little problem but i am doing pretty good!
TheOverseer96 1 month ago
@TheOverseer96 Actually no that i look at the comments lots of people are having trouble..? so i guess i am a genius? :D
TheOverseer96 1 month ago
Hey when I run the program, I get this error printed: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 8 at apples.main(apples.java:8)
What does this mean and how could I fix it?
wilmantube 4 months ago
Excellent series.
Koreman11 4 months ago
@xaxjx88 When he uses the change-method on the array called bucky, then the array called x will have the same numbers and the same length as bucky. And since there are 5 numbers in bucky, the length is 5.
unern 4 months ago in playlist Java Programming Tutorials
Comment removed
cockycoding 4 months ago in playlist Java Programming Tutorials
Can array be passed onto a non static function? Because when i tried a non static it doesn't work.
Killer0079ly 5 months ago
not going to use a foreach loop?
for ( int i : x){ i+=5;
}
would this not be better?
JeBuSv20 5 months ago
@JeBuSv20
No, you can't use an enchanced for-loop in the change-method.
If you do, you create a variable i, and set its value equal to each number in the array, respectively. When you add 5 to the number i, the numbers in the array will be left unchanged.
That's because i is not the same variable as those numbers. It only has the same value as them.
It's like two people having the same amount of money, then one of them gets 5 more coins.
unern 4 months ago in playlist Java Programming Tutorials
I tried to make this work, but I couldn't :( public static void change(int x[]) { for(int z:x) x[z]+=5;
Jesteria78 5 months ago
i have one question that when method change( ) was of type void how can u return changed array?i.e it is out of scope of main method.isnt it?
chetannarayangupta 5 months ago
@worloxi Thank you so much, you just saved me a world of butthurt.
michaeldcurry1 5 months ago in playlist TheNewBoston - Java Programming
my teacher teach us this for almost 3 months ! and i took all of it with just 3 hours Can u be my teacher !
cheese0218 6 months ago
Comment removed
eighteen4eva 6 months ago
anyone else notice that he is doing this at 4 am in the morning. I didnt realize that until his words started slurring lol..
Phillie103 6 months ago
you should get paid for this, quite useful
DarkBlueHated 6 months ago
@DarkBlueHated go to thenewboston(.)com and click on the ads on the right.. thats the one way you can pay buck.. :)
silverwing1221 6 months ago
@silverwing1221 Thanks for that info! Ima randomly click his ads, i might even bake him a cake and send it to him too.
lpguitarist06 5 months ago
@DarkBlueHated he gets paid from his partner ship (the videos you see before and the ads on the right. He also has a donate link on his channel.)
Phillie103 6 months ago
Why doesn't it work...
zerohourkevin 7 months ago
why is it not
counter<=x.length
and just
counter<x.length?????
frostshadow5 7 months ago
Comment removed
farzad2340 7 months ago
This has been flagged as spam show
@frostshadow5 Because computer always starts 0 for first Index instead of 1. For example if the number of arrays is 6, the computer starts from 0,1,2,3,4,5
farzad2340 7 months ago
@frostshadow5 Because counting starts at 0, so an array that has seven things in it (length seven) occupies spaces 0,1,2,3,4,5 and 6, for example. Therefore x[x.length] doesn't exist, only elements up to x[x.length-1] (or counter < x.length), so if counter went up to x.length (counter<= x.length) you would get back an error for trying to access something that doesn't exist. Hope that makes sense :).
sushifiesta57 7 months ago 2
also I would give the code I made but like bucky said you can't put code on!!! Curses....is there ways u can message people? I'll try
Ubercool29 7 months ago
Ah sweet I'm doin the same as you. I read ints are NOT assigned pointers so this will only work with arrays because he is manipulating the object through the 'copied' pointer but this is not the case with an int. It's interesting because you can manipulate the copied pointer but not the original. try making a method to take two arrays swap the pointers and then change the object through the swapped pointer. you will change the "other" object. I tried it and it worked so now I understand :)
Ubercool29 7 months ago
you forgot to talk about if it is only one line it doesn't need brackets when you did the for loop
xXeROCK1995Xx 7 months ago
How does it change the array? I thought it was pass by value not pass by reference in Java. Someone please explain what I'm missing...
matthewdoucette 7 months ago
This has been flagged as spam show
@matthewdoucette it changed it because x is your array and when it did x[counter]+=5 it added 5 to each one because the counter keeps adding by 1 in the brackets if you still need help email me at mfransen2016@hotmail.com
xXeROCK1995Xx 7 months ago
Hey I am likewise confused but I think it has something to do with the pointers used. Apparently the "pointer" or "reference" is passed by value so if you do a data manipulation using the pointer it will change the object. I hope that makes sense, I'm not very good at explaining but pointers are quite a good computing concept to have so just reply to this if you want me to go through that. But interestingly enough try the code without an array and just an int. It WONT change the object. WHY?
Ubercool29 7 months ago
@matthewdoucette Hey I am likewise confused but I think it has something to do with the pointers used. Apparently the "pointer" or "reference" is passed by value so if you do a data manipulation using the pointer it will change the object. I hope that makes sense, I'm not very good at explaining but pointers are quite a good computing concept to have so just reply to this if you want me to go through that. But interestingly enough try the code without an array and just an int. It WONT change.
Ubercool29 7 months ago
@Ubercool29 I am well versed in C++ and pointers and all of this, and passing by value and reference. So really I just need to know whatever rules are followed in Java and then memorize them, as I understand the concepts perfectly. So, I guess, my real wonder was why is the rule different for a variable and an array? I'm not sure, but, as you said, it's obvious the array is passed in via its pointer (likely as by value but it doesn't matter) and variables are not. Thanks for replying!
matthewdoucette 7 months ago
Bucky is simply superb,thanks for making learning so easy! :)
gourigaikwad 7 months ago in playlist Bucky's Java Tutorial
bucky this is serious, please create a video tutorials for sale! with more and more examples etc... I study programming and I understand you more from you that my asshole teacher
maybe do it with lynda dot com? I can pay for more of your tutorials
anderzom 7 months ago
also, why should the method be static?
seed419 7 months ago in playlist Bucky's Java Tutorial
oh nevermind. Why can't this method exist within the main method? That's why I was getting an error. It has to be outside of the main method....I guess that makes sense...
seed419 7 months ago in playlist Bucky's Java Tutorial
Comment removed
seed419 7 months ago in playlist Bucky's Java Tutorial
why are there no {command bracets} following the enhanced for loop?
rustondust 7 months ago
@rustondust notice he didn't put a semi colon at the end of the for line. That means the program will execute the next block of code for x times. since he is only using one line of code after his for loop, brackets aren't necissary
DrGreenEyedGiant 7 months ago in playlist thenewboston Java Tutorials
my dream is to reach bucky's knowledge, he is absolute programming animal
bgcopkilla 7 months ago
when you said "welcome to your thirty-second java tutorial", i thought the tutorial was going to be thirty seconds long for a second
jlubi3jpl 7 months ago 29
How did the script know bucky = int x when you made the change class? Because the change class have an empty array called x that adds to 5 everytime in a for counter loop and then Bucky is called into this one and the change class automatically sets the empty array int x to bucky??
I thought you had to declare it, or am I totally lost?
ddzproduction 7 months ago
why it doesnt work to do that "for(int x:bucky)" in the 2nd method?
like for(int i:x) {
i+=5;
} ?
asdFRap 7 months ago
@asdFRap because when you add 5, your only changing the variable holding the numbers, and not the array itself. for example the integer "i" was only holding the values of the array, and is not the array itself, so when you change the "i" value... your not even changing the array at all
Gam3r979 7 months ago
@Gam3r979 oh i see. thanks buddy
asdFRap 7 months ago
you are the only one who can teach me with ease
MANUDAREable 7 months ago
Just to make things clear, if i am getting this right.
int x[ ] is supposed to take bucky [3,4,5,6,7],
counter<x.length, the length is 4 (starting from 0 from bucky[3,4,5,6,7]),
x[counter] +=5, works like x[0] +=5 where x[0] is 3., x[1] is 5, x[2] is 6 etc
360felix 8 months ago
@360felix yeah!
kbxtc123 7 months ago
how to make all field is private > sorry-im new in java..please help me..
Kyuoera 8 months ago
looking at the comments now make me feel like im about to get my mind blown...:/ wish me luck
t89pepper 8 months ago
THANK YOU SOOOOO MUCH THESE JAVA VIDEOS HELPED SOO MUCH! CONSIDERING MY TEACHER DOES NOT EXPLAIN ANYTING NOBODY IN THE CLASS GETS IT.
TRINAAAoh 8 months ago
I was like 30 second tutorial? What its 6 minutes!
then oooohhhh 32nd...
YXYWantedOrphan 8 months ago 2
why do i have to make a new variable( y )?
ahhashim 9 months ago
@ahhashim While looping through the array bucky , it stores all the value in y
kbxtc123 7 months ago
This tutorial is getting hard.
Arluness 9 months ago 33
@Arluness Thats what she said
xero907 5 months ago
Why doesn't an enhanced for loop work in the change method? The values don't change. If I want to print the changed values, I have to print from within the change() method.
private static void change(int x[]) { for (int counter:x){ counter += 5; System.out.println(counter); //this will print the new value }
}
riprescot 9 months ago
@riprescot I was wondering the same thing :(
Odznitcholuf 9 months ago
@riprescot
An enchanced for loop will increment your counter variable for you. You are probably getting an error because you are manually trying to increase it.
saksepapirlim 8 months ago
Since i knew C++ before this i know most but all of thenewbostons tutorials always help me:))
cgmwgb138 9 months ago 2
MY BRAIN!!!!!!!!!!!!!!!!
heath2357 9 months ago
Oy! my head, gonna have to look at it again later
MrZeval 9 months ago
why wont you just declare the array as an instance variable?
Iakosa 9 months ago
This tutorial is wayyyy longer than 30 seconds!
yemieko 9 months ago
@CloseButton of course
Yudraciell 9 months ago
good job. Is there a video you have on here that would teach me how to modify the array program so it takes inputs of digits from the keyboard and displays which digits is missing?
keelathebee 10 months ago
Okay, so now I've watched 32 of you vids.
First of all, thanks for the great turtorials! Keep up the great work!
You're actually a more thorough teacher than the one I have at my university... scary thought.
Here's a tip for you though: You can type Syso and then hit ctrl+Spacebar to autotype System.out.println(); - might make things easier for you ;)
warloxi 10 months ago 56
@warloxi better than my lecturer too by a long shot
kachekieran 9 months ago