for people who had trouble understanding this i rewrote the program a little neater with a few comments to make this 10x times more easier to learn :] 1st class //as always we will import our scanner to take info from the user import java.util.Scanner; class apples { public static void main(String args[]) { System.out.println("enter name of first gf here: "); Scanner input = new Scanner(System.in); //we make a variable temp and attach it to our input String temp = input.nextLine(); tuna tunaObject = new tuna(); //here we attach temp which is our input to our method setname tunaObject.setname(temp); //and finally we call out our method saying to display the output tunaObject.saying(); } } 2nd class //here we will use many methods in different classes to output our single program public class tuna { //to give ourselves a little challenge we will use private instead of public //private means only variables after private can be used in the same class not in any other class //here we have a variable 'girl name ' in private which means only this class can use it private String girlname; //here we build a method to attach a public variable to the private variable girlname public void setname(String name) { girlname = name; } //here we will build another method which will not contain void as it is returning a variable public String getName() { return girlname; } //here we use another method public void saying() { //where we use a new statement print f which can be used to print out a variable like a string System.out.printf("your first gf was %s", getName()); } } hope this helped .
Void methods dont have a return type, meaning when you run them, they don't return anything String methods have a string return type, so when you run them, you get a string back. For example, when you do .length(); to find the length of something, you are actually calling an integer method that returns an integer to the location it was called.
What I do when I do not understand one of these videos, is try and see what i do not understand in the video and search for explanations by other people on UA-cam. If I do not find a good explanation on UA-cam, I start to Google. One way or another, I find the explanations, and then come back to the video and things seem much clearer. Finding solutions is better then just giving up.
Let me explain if you guys didn't understand. In this class he defined a private variable. Private means that it can only be accessed directly by that once class. He creates a method called setName, which is supposed to set what girlName equals. It passes the input type of String, and the name of that string is "name" It's basically the same as String name = "Hey whats up", except for you have not defined what name actually is. getName is another method he created to get the name after he has set the name. To do this, he makes it return whatever the girlName variable is. This would not work if in your main method aka the method public static void main(String [ ] args) within the class apples. So for instance Tuna example = new Tuna(); Tuna.setName("Mary-Kate"); System.out.println(Tuna.getName); This will return "Mary-Kate" in the log. The next method he wrote was void, so therefore there can not be a return statement such as return "Dickface"; the %s is a placeholder, and the way this specific line of code works is that you can add an arguement at the end of it seperated by a comma. He has %s at the end, and then calls the getName class to get the name that he will end up setting in the main method. Tell me if you need any more help.
i understand what you are saying but cant use i because i cant use printf if you could tell me why i would be very grateful as i don't want to give up but im on the verge
Themostamazinguy this is exactly what it say's The method printf(string, Object[]) in the PrintStream is not applicable for the arguments(String, String) i think it wants me to turn getName to an object[] so i can use printf as (String, Object) if that is so what is the print for (String, String)
StickWarpStudios I'm still not 100% sure what you, but I think I understand Lets say you have a method printf public void printf(String doggy){ } String is the data type. Doggy is the name of the variable Same as String doggy; the difference here is that you are making a method so it cn be used by other classes. Void means it has no return statement. This whole thing is made just so it can return a local variable within this class Lets say you have the variable Doggy String thedoggy; you want other classes to access it public void printf(String doggy){ thedoggy=doggy; } I think you could also do this String doggy; public void printf(String doggy){ this.doggy=doggy; //Which means that it's setting the string called doggy, a variable within the class equal to doggy within the method. } Doggy within the class and doggy the name of the string are two different variables, so you have to declare the equal eachother with this.doggy=doggy; Hoped this helps.
I know this was commented 7 years ago, but for anyone else struggling now: even though these are just a few lines of code, the object-oriented programming concepts are not easy to understand if you're new to writing software or programming. Don't give up, just take a short break and come back to try again. I struggled in my initial few months and then hit a point where it all clicked and became obvious (to the extent that I wasn't sure why I struggled in the first place).
I saw a few struggles on the printf topic still. Java has many ways to format characters and strings. One of many is the following which is a part seen in this video: printf stands for print format. It allows you to pass values directly into the system.out parameters using FORMAT CODES. %s stands for passing in a STRING VALUE. %s is put inside of quotes of a string just like ("Hi my name is %s") %d is used for an INTEGER VALUE. These are just few. After specifying them into quotes: System.out.printf ("Hi my name is %s. I am %d years old.", getName,getAge); As shown above,the value is then described being separated by comas. YOU NEED TO SPECIFY AS MANY VALUES AS YOU ARE CALLING WITH THE FORMAT CODES. Above you see I used 2... One for a String...one for an Integer. So it needs to have those values specified and separated by comas. Exactly as i demonstrated above. Of course one can just say ("Hi my name is" + getName) Which can be called by println, print and printf. That way is universal ...but you WILL GET AN ERROR if you try using these special format codes ( %s ...%d ...ect...)using println and print. It can only be used with printf. In my opinion its a very nice, clean way to write programs and printf has it's many benefits in far more complicated and specific coding. I hope this helps. Have fun learning and never give up! I hope to be an awesome programmer one day because I am still a beginner.
I didn't get it the first time i watched the video, but I understood it perfectly the second time. It's sure allot for one 7 min lesson and needs a bit of practice.
Agreed, I think this is where people kinda start tilting away, as you can sloowly begin to see from the view count if you've been watching all the tutorials in order up until now.
The best way i learnt is to watch the tutorial once while doing it and then attempting it by myself without the tutorial and using the eclipse IDE to help you troubleshoot as you go. do this 3-5 times and you'll learn more each and every time
+codelyoko373 How did you learn apart from these videos? I am currently very new to Java and I'm having A LOT of trouble to remember and understand all of this right now. Will I remember it by the end of the tutorials or did you use some other things aswell?
+mtn In my experience, you start to understand stuff the more you learn. Like I said, when i watched this video about two years ago, I was extremely confused on how to do this or even why you would do it. But the more I learned, the more this type of stuff made sense to me. I didn't actually watch many of the tutorials on Java as i just got bored of the language. I went on to learn C# so I could create games in Unity and thats mainly how I learned everything I know and how all this makes sense. Almost all programming languages work the same way, using if statements, functions and so on so once you've learned one, it's easy to learn another. Java is a excellent starting point for learning how to program. Once you've understoof how Java works and how even programming works, maybe move onto a different language and learn that. Or you could stick with Java and expand your knowledge of it as there is always something to learn Hope this helped :)
+codelyoko373 Yeah I started no long ago and it was the same, nothing made sense...now it's making a little more sense. it;s what you are saying. Keep going learning and memorizing as much as you can until you understand how it works. Although school would be the best option for you mtn and all those trying to learn programming. I can't wait to start college on this!
Believe me, it's worst if english is not your first language and you have to watch the tutorials anyway... PD: I do it because i love how bucky explains so easy all this.
***** No, Java is a good programming language though not as good as a language such as C#. I decided to switch to C# just so I could start using Unity.
If I can get a really good understanding of Classes, Methods, and Objects/Instances then I think I will be good to go for Java. Im so used to non object oriented programming that I am having a hard time really grasping this concept. Im used to writing one long and big program instead of writing small mini programs using classes and objects.
If any of you were confused by this video, don't worry. He confused the hell out of me too. String is simply a group of characters (a b c d) strung together. So String girlName, girlName is just the variable. He is using this thing called 'camelCase' which you can google. It is the process of capitalizing the second word in the string, but not the first. He however, failed to mention this, which causes a great deal of confusion when you begin to wonder, 'What the hell is with this weird notation he is using?' Additionally, in line 3 of tuna.java, 'public void setName(String name)', he is again using camelCase to define another variable. setName is the name of the method, and inside that method is a string variable called name. He then finally sets the variable name inside of the setName method equal to the string variable girlName.
If you are having troubles with these videos making sense try watching the entire video without touching eclipse just trying to understand how everything is working. Then, watch it again while copying what he does into your own eclipse. Then after that try and do it without the video running. It worked really well for me.
That is a great point you made there,sir.I am beginner just like 99% people here,and since i couldn't even grasp this code after first viewing (mainly because i didnt understand the point of it,or atleast why it is so complicated) i started to write things down,color code connected pieces,and step by step i understood what each thing does.
+Adam Cole Using the setName method of our tuna class, we set the name of our first gf to temp variable. Then when we use saying method, it gets her name by calling the getName method inside it.
The string variable "temp" is being passed on to the parameter string variable in the setName method of the "tuna" class called "name". "Name" is then being passed on to the private string variable outside the method called "girlName". The "getName" method returns whatever value is contained within the "girlName" variable, which is printed out when the "saying" method is called in the main class. I know that probably sounds extremely confusing to anybody that is relatively new to the language, but keeping working at it and listening to the tutorials very carefully. It will start clicking into place eventually :-)
+Danny Semakov - String temp = input.nextLine(); temp is assigned with whatever user types on kb. tunaobject.setname(temp) temp is passed on to method 'setname' in tuna object. Then this is stored in girlname. Value in girlname is returned to apples which then executes method 'saying' in Tuna. When you see setname(temp) it means execute method setname with parameter the value stored in temp.
Ahhhh this one was so hard! I agree with Lord Farqwhad, the first 14 videos were really easy, I got them instantly, the 15th video I had to review it and play around with it, but this one....gah
Thanks for sharing with your method of obtaining knowledge. Everyone does it differently - I generally repeat everything what he does and after that I draw a logic map for myself to have it before me which helps me to get an in depth understanding of what is happening when I write this or that block of code.
When I go and type the public void saying() { System.out.printf("Your first gf is %s ", getName()); } the program tells me as an error, and I quote, "The method printf(String, Object[ ]) in the type PrintStream is not applicable for the arguments (String, String)", but when I go ahead and replace the printf with println, it works perfectly fine. Any idea how I can fix it to work with printf and %s? Edit: I solved it. If anyone else has the same problem, go to the Project > Properties > Java Compiler and check out the JDK Compliance, and set it to atleast 1,5.
Is there any particular reason Eclipse comes installed with it being set to 1.4? I had the same problem so I just used println but I was also curious why it wasn't working, so thanks.
I'm not entirely sure myself, I just googled the same error I got, and wasted a couple of minutes of my life to find that someone already had the same problem, and just corrected it. Glad it helped, cheers.
For those having difficulty reading Bucky's code: Step 1: Separate every line of code with a newline Step 2: Group similar lines together (for example, the defining of objects like tunaObject and input) Step 3: ??? Step 4: Profit
Ah really. I'm heading into university this February (Australia) so these courses are just for me to see whether I like programming becaue I'm considering it as a major.
I recommend you start with C# or even a markup language like HTML before u get to the actual programming, i started with C# and i can pick up java in a blink, because most of the syntax is the same :)
I just wanna drop a big thank you to you again. You might not get into technical details for most of your videos and use easy exemples, but this make it easy for beginner like me to learn compared to lots of tutorials online!
+Prakhar Satyam Basically, it just sends data back from the function. If you were to use"tunaObject.getName()", you would get girlName, because that's what the function returns
I know this isn't optimal code for the program objective, but this is actually a very good tutorial. I had to write down the code on a piece of paper and figure out what each method was actually doing, but I got it eventually. I definitely won't forget it.
Guys , if you have problems understanding in the first day , try next day , it worked for me. Just analyze everything bucky said and wrote and you will get the logic of the system.
+Nitish Nayar because if it was a public variable, other classes would be able to change the value. This way they can only read it unless you add a mutator method
I'm just learning this RIGHT now (watched the video for the first time just now), so hopefully a beginner explaining it is a good way for other beginners to understand it.
Not only that, but there may be some genius going on here. I'm betting he know that this question would get asked, and that almost everybody here is a beginner. This means that some of us will read and increase our understanding of the code in order to answer the questions of the other beginners as well. This increases the knowledge of everybody involved.
These are great tutorials. this one made me realize that I will need to practice a lot because it's difficult to remember how to call things and why we structure things certain ways. when I try and do it without looking at your code i make a lot of errors so i have to go back and see how you wrote it.
I feel like this may be an over complication of the purpose of this video. The purpose is to store a user placed name inside a variable for future use. So if he puts in that his first girlfriends name was becky, then the program will respond with "your first girlfriends name was becky" However, there is a much easier way to do this using a scanner and .next line. EX: import java.util.Scanner; class file1 { public static void main (String[] args) { Scanner scan = new Scanner (System.in); String gf; System.out.println ("Input the name of your first girlfriend"); gf = scan.nextLine (); System.out.println ("your first girlfriend was " + gf + ""); System.out.println (); } }
Bucky, I have mastered all of your java tutorials up to this point. This one is extremely confusing for a beginner like me. I think splitting the tutorial in separate sections or videos would be great as well as taking this all slower and explaining more clearly of what each thing does. I see you know it so well that you just fly through not thinking so much about how much people like me understand it. Other than that great job!
if you actually want to get a good understanding of this, try some codeacademy tutorials for python, they teach you the basics of programming, and it helps ALOT. I tried doing java about 1 year ago, gave up around here because progress was 0. Went to codeacademy to learn some simple python, and now everything makes a lot more sense, only the syntax is a bit diffrent. Python is really easy to use and will get you used to object oriented programming, dont give up :) and if you already have, then i hope you will at least attempt it once more.
Trust me I never give up! I just skipped it and just let time pass by and see next time if u understand it. Turns out it did. I completely understand the lesson. I'm on 35 now
You need to read it to. Find some books or online edition and read about those stuff. It is easy, just it can be confused in beginning - why that is here, why this is here, how that return there,... :). And try to type this code in your way several times and in every line type a comment // this line mean...program doing this and that....
Saw this on Stackflow that helped with printf problem "I'm sorry about my previous post saying I had the same problem, I didn't read the "before you post read this" dialog box that says don't do that. Well, after a lot of time looking around for the answer, I figured it out myself. In Preferences->Java->Compiler box, there is a button in the top left corner called "Configure Project Specific Settings...". Click it and either change the compliance level to >= Java 1.5, or turn it off. Boom, fixed. "
Download the book Java how to program 9 edition(paul deitel). and read the chapter 3. it has a similar example like this. and one SUGGESTION!!! READ SLOW FOR AVOID CONFUSE is not literature ...is programming :D cya i hope i help you .
True. but I believe he was just trying to show how the methods interact with each other and basically put multiple methods in the same video to explain better...
Although i also use that method it is a lot cleaner to use the printf as you can do; printf("Hey %s, How are you %s", string, string) Rather than; println("Hey" + getName() + ", How are you" + getName());
if anyone facing a problem with printf Error Saying:"The method printf(String, Object[ ]) in the type PrintStream is not applicable for the arguments (String, String)" Thats because printf was added in JDK 1.5 release. How to solve it: You have to ensure that you're using a JDK 1.5 or above, and it is editable. Go to the Project --> Properties --> Java Compiler and check out the JDK Compliance, then change it to at least 1.5
+Sinehmatic It is made that way on purpose.. we can easily make all this in two simple lines inside the main function. However what he is trying to show is how to use multiple classes, and multiple functions or methods at the same time. How to play with them which will later allow us to build more complex apps.
+Sinehmatic I think so, but I think that this comes about as part of the nature of Java and Java programmers, seeing as it was designed for more complex applications, and most people would use it for more complex applications, so teachers like bucky would just be used to writing it in this way
+Sinehmatic That was my first thought too. But I guess since this is a beginner's guide to Java, he is giving simple, easy to understand examples but also showing us how to do different stuff ( in this case multiple methods)
And there are lots of us here with the same issue...It cleary means , he overlooked some of the stuff, and took it for granted that beginners will understand certain things and went ahead.
thanks bucky, i understood it, i played around with it and i created many examples but it takes time to master i replayed the video many times. 15 tutorials yesterday and only this tutorial today :O
@ lacus1122 : 1. The keyword private, when used on an instance variable or method means that it can only be used inside the class in which it was declared for security reasons and stuff like that 2. Return is a statement which says what the output of the method is, which ties into ur last question: 3. void simply means that the method has no output and therefore doesn't need a return statement, in the method head u mentioned, the output declared was a string, which is what the method returned
Robert Haxor good, weather isn't always good but in Galway, people are good and life is good, average house for a family of 5 :) Come here on holidays some time :) you'll enjoy dublin's Tayto park! (The potato chip company made it lol)
I saw a few comments about people who didn't know what's going on. I'm a beginner too, but I have the feeling I can help. *girlName* is a private variable of the class "tuna". This means, it can't be used in any other classes (in this case apples.java). This means you need to add methods (methods are just like functions, with the addition that you need an object to use them) to work with the variable. You can't just change or print it by using the variable, only the methods from that specific class have access to it. What you usually need to do is like this 1) make setter/getter 2) create an object >>>tuna tunaObject = new tuna();>tunaObject.setName(temp)>>System.out.println("Your first gf was " + tunaObject.getName());
For the people who does not understand all of what is being explained in the video or in the past videos, i recommend a book that is called "How to program in JAVA" by Deitel & Deitel ; in this book it is explained all about java (variables, loops, methods, classes, instances, etc.) i recommend this book as a complement to the videos :)
I'm learning java with these videos myself too. The confusing part for me, was temp too. What worked for me was, try to write tut 15 on your own without help of Bucky. It was very hard, but now ie understand things better. Huib from Holland
You just made this incredibly hard in comparison to 15. I mean feels like this should be 19 at least !!! I just can't understand why we need private String girlName; !! and for example let's say I don't want that line of command .. I want to execute this program without the private String .. how can I do that ? exactly the same thing .. just without the private String .. I can't figure it out ! can anybody help me ? please !
***** Ok i will try to answer you, actually the private value isn't really necessary in this small program that he made, when it becomes important is in bigger programs where the private method is a way of handling complexity, a private method can only be accessed from inside the same class, so if something goes wrong with that, there is usually only one source file to look at. If you have a 100 lines of code in your project but your classes are kept small, this can reduce your bug tracking effort by a factor of 100.In the program he made the other classes don't need the girl name it only needs the out put which is " you first gf was ex", i hope this helped
sahraoui sidahmed Ty for the answer .. No you didn't understand, I understood the difference between private and public methods ... I just didn't understand why the program won't work without that "pirvate String girlName" instance ... I know he did it for the purpose of teaching .. but it's redundant in this case .. so I was trying to make the program work without it .. and I just couldn't .. how can I make it work without that instance .. that's my question !
***** And yes it exactly the same thing just with out private String, remember there are multiple ways to do something in java, i really hope this time i answered your question if not tell me
Okay, I am coming from episode > 30, and trust me, this makes so much more sense now. My recommendation is to try and understand as much as you can regarding this, then move on. The next few episodes aren't so bad actually.
If you do have problems with the little program, just replace the printf and %s statement with System.out.println("Your first gf was " + getName());. Worked for me though. BTW try to type in syso, hold ctrl and press space. Thank me later. Great tutorial so far. Big ups mate!
It is good practice to make all of your class variables private because when you have a ton of classes you won't want to get variables with the same name mixed up. He names the variable "temp" only to show that it is different than the private variable in the tuna class, but naming "name" won't make a difference, because the variable "name" in the tuna class is private. Hope this helps!
You had to say that @ 5:53, didn't you? Man it's amazing to have such a complete package free of charge! I'll be proud when I make my first donation, although I'm well aware that subscribing did add to your statistics.
Typing syso and then pressing Ctrl + Space will give you System.out.println(); I highly recommend adding a System.out.printf("", arg1); shortcut to Eclipse. Go to Window -> Preferences -> Java -> Editor -> Templates -> New... For name, type sysf For description, put whatever you like For pattern, type System.out.printf("${cursor}", arg1); Now you can just type sysf and press Ctrl + Space and it'll give you System.out.printf("", arg1); with your cursor inside the string! :D
@NGCoderHD, good question. Although creating the getName() method is not required in this particular program (if you omitted it, you would replace the getName() with girlName), creating a method which returns the variable is good practice if you ever create programs with multiple classes. The getName() method allows for better organization, and allows the user to access the variable from another class.
The first 16 tutorials were very helpfull to get me started. But as we have prgressed i noticed that the way bucky teaches is not good if you want to go very far. It will just get you started. If you are totally new to java programming i suggest reading the book "Java for Dummies" Learning from it and the coming back to this video helped me alot
Bucky. I know you have like 300,000 subscribers and over 3,000 videos, and this one is old so you'll probably ignore it and ignore this comment too. But if you do happen to read this, I just want to say that these tutorials are awesome. What you do is very good. You provide people with the knowledge to program and then maybe some will go further to make games and make money. I am learning Java to learn Slick to learn OpenGL to make games. Thank's bucky! You're the best! I'm sure others agree too
It took me a couple minutes of extra thinking to figure out why things were happening, but an easy way to explain it: tunaObject.setName(temp) is used to tell your setName method to grab the information in the variable temp. setname now has a value for setName(String name), so that name variable is now whatever temp is (and temp is getting its data from input.nextLine from the scanner). Now that setName has a value for name, girlName=name; has a value to set girlName to.
"she was a babe" hahahaha best tutorials
+bakedrabbitdevil779 hahahaha
Lol, cracked me up.
lol
xD
I thought his first gf was Tuna..
Lol xD
Omg. Good one. Very funny! ;-D
ahahahahahahahahahahaha
that's what i typed instead of gf's name
Tuna can be a hungry man best friend
System.out.println("Error 404 : No Girlfriend Found");
LMAO
OMG SAME ERROR HERE WTF?? ILLUMINATI CONFIRMED? Δ
*Creates a getGirlfriend method*
try to import java.util.Girlfriend
lol
Lmfao
I lost my shit at the "She was a babe" part, hahahaha, you're one of a kind bucky!
+Γιώργος Φωτόπουλος same here xD
I was literally rofl i kid you not.
me too. I giggled :D
Haha same, that shit was funny
haha me too.
"She was a babe" -- Bucky, May 9, 2009
for people who had trouble understanding this i rewrote the program a little neater with a few comments to make this 10x times more easier to learn :]
1st class
//as always we will import our scanner to take info from the user
import java.util.Scanner;
class apples
{
public static void main(String args[])
{
System.out.println("enter name of first gf here: ");
Scanner input = new Scanner(System.in);
//we make a variable temp and attach it to our input
String temp = input.nextLine();
tuna tunaObject = new tuna();
//here we attach temp which is our input to our method setname
tunaObject.setname(temp);
//and finally we call out our method saying to display the output
tunaObject.saying();
}
}
2nd class
//here we will use many methods in different classes to output our single program
public class tuna
{
//to give ourselves a little challenge we will use private instead of public
//private means only variables after private can be used in the same class not in any other class
//here we have a variable 'girl name ' in private which means only this class can use it
private String girlname;
//here we build a method to attach a public variable to the private variable girlname
public void setname(String name)
{
girlname = name;
}
//here we will build another method which will not contain void as it is returning a variable
public String getName()
{
return girlname;
}
//here we use another method
public void saying()
{
//where we use a new statement print f which can be used to print out a variable like a string
System.out.printf("your first gf was %s", getName());
}
}
hope this helped .
very nice explanation / can you give me your social contact please?
very nice explanation / can you give me your social contact please?
+kioup fkejd what if we set getName() to private since we only use this method inside the class? Would it be correct?
+Javier Hdz C yes, that is correct.
I think it's good to know that you can use a temporary variable
When I scroll down for help and instead am bombarded with "I don't have a girlfriend" jokes...
lol, every1 lost their mind on his gf
she was a babe
what is difference between void and String? what does return does in getname()? please help?
Void methods dont have a return type, meaning when you run them, they don't return anything
String methods have a string return type, so when you run them, you get a string back.
For example, when you do .length(); to find the length of something, you are actually calling an integer method that returns an integer to the location it was called.
Prashant Basnet void means it does not return any data type
Like your life which did not return any gf lmao
I'm gonna go bye....
It feels so awesome when you finally understand it after a couple of hours of intense thinking.
What I do when I do not understand one of these videos, is try and see what i do not understand in the video and search for explanations by other people on UA-cam. If I do not find a good explanation on UA-cam, I start to Google. One way or another, I find the explanations, and then come back to the video and things seem much clearer. Finding solutions is better then just giving up.
Well... do you have any better videos?
Jay Bartgis Programming Methodology (Stanford)
Yeah or just post the portion of code to stackoverflow. You'll get an explanation by the end of the day guaranteed.
Thanks for this advice
How have you been so far by the way ? :D
Let me explain if you guys didn't understand.
In this class he defined a private variable. Private means that it can only be accessed directly by that once class.
He creates a method called setName, which is supposed to set what girlName equals. It passes the input type of String, and the name of that string is "name"
It's basically the same as String name = "Hey whats up", except for you have not defined what name actually is.
getName is another method he created to get the name after he has set the name. To do this, he makes it return whatever the girlName variable is. This would not work if in your main method aka the method public static void main(String [ ] args) within the class apples.
So for instance
Tuna example = new Tuna();
Tuna.setName("Mary-Kate");
System.out.println(Tuna.getName);
This will return "Mary-Kate" in the log.
The next method he wrote was void, so therefore there can not be a return statement such as
return "Dickface";
the %s is a placeholder, and the way this specific line of code works is that you can add an arguement at the end of it seperated by a comma.
He has %s at the end, and then calls the getName class to get the name that he will end up setting in the main method.
Tell me if you need any more help.
i understand what you are saying but cant use i because i cant use printf if you could tell me why i would be very grateful as i don't want to give up but im on the verge
StickWarpStudios What do you mean by "I can't use printf". If you tell me i could probably help.
Themostamazinguy this is exactly what it say's
The method printf(string, Object[]) in the PrintStream is not applicable for the arguments(String, String)
i think it wants me to turn getName to an object[] so i can use printf as (String, Object) if that is so what is the print for (String, String)
StickWarpStudios I'm still not 100% sure what you, but I think I understand
Lets say you have a method printf
public void printf(String doggy){
}
String is the data type. Doggy is the name of the variable
Same as
String doggy;
the difference here is that you are making a method so it cn be used by other classes. Void means it has no return statement. This whole thing is made just so it can return a local variable within this class
Lets say you have the variable Doggy
String thedoggy;
you want other classes to access it
public void printf(String doggy){
thedoggy=doggy;
}
I think you could also do this
String doggy;
public void printf(String doggy){
this.doggy=doggy;
//Which means that it's setting the string called doggy, a variable within the class equal to doggy within the method.
}
Doggy within the class and doggy the name of the string are two different variables, so you have to declare the equal eachother with this.doggy=doggy;
Hoped this helps.
StickWarpStudios Im having the same problem :(
This is the hardest tutorial out of the 16 I've watched so far.. Not giving up though, maybe I'll come back later to get these rows in my head.
I know this was commented 7 years ago, but for anyone else struggling now: even though these are just a few lines of code, the object-oriented programming concepts are not easy to understand if you're new to writing software or programming. Don't give up, just take a short break and come back to try again. I struggled in my initial few months and then hit a point where it all clicked and became obvious (to the extent that I wasn't sure why I struggled in the first place).
I saw a few struggles on the printf topic still.
Java has many ways to format characters and strings.
One of many is the following which is a part seen in this video:
printf stands for print format. It allows you to pass values directly into the system.out parameters using FORMAT CODES.
%s stands for passing in a STRING VALUE.
%s is put inside of quotes of a string just like ("Hi my name is %s")
%d is used for an INTEGER VALUE.
These are just few.
After specifying them into quotes:
System.out.printf ("Hi my name is %s. I am %d years old.", getName,getAge);
As shown above,the value is then described being separated by comas.
YOU NEED TO SPECIFY AS MANY VALUES AS YOU ARE CALLING WITH THE FORMAT CODES. Above you see I used 2... One for a String...one for an Integer. So it needs to have those values specified and separated by comas. Exactly as i demonstrated above.
Of course one can just say ("Hi my name is" + getName)
Which can be called by println, print and printf. That way is universal ...but you WILL GET AN ERROR if you try using these special format codes ( %s ...%d ...ect...)using println and print. It can only be used with printf.
In my opinion its a very nice, clean way to write programs and printf has it's many benefits in far more complicated and specific coding.
I hope this helps. Have fun learning and never give up! I hope to be an awesome programmer one day because I am still a beginner.
When you said %d and %s standing for integer and string... Do you know where I could find a list of all the format codes?
Jay Bartgis docs.oracle.com/javase/8/docs/api/java/util/Formatter.html
Thanks man. I was looking for that
It's just some comment. 😉 thank you
I thought "print the fuck"
I didn't get it the first time i watched the video, but I understood it perfectly the second time. It's sure allot for one 7 min lesson and needs a bit of practice.
Agreed, I think this is where people kinda start tilting away, as you can sloowly begin to see from the view count if you've been watching all the tutorials in order up until now.
The best way i learnt is to watch the tutorial once while doing it and then attempting it by myself without the tutorial and using the eclipse IDE to help you troubleshoot as you go. do this 3-5 times and you'll learn more each and every time
It's so amazing to come back to this video after two years of programming since and remembering when I was so confused about all this XD
+codelyoko373 How did you learn apart from these videos? I am currently very new to Java and I'm having A LOT of trouble to remember and understand all of this right now. Will I remember it by the end of the tutorials or did you use some other things aswell?
+mtn In my experience, you start to understand stuff the more you learn. Like I said, when i watched this video about two years ago, I was extremely confused on how to do this or even why you would do it. But the more I learned, the more this type of stuff made sense to me.
I didn't actually watch many of the tutorials on Java as i just got bored of the language. I went on to learn C# so I could create games in Unity and thats mainly how I learned everything I know and how all this makes sense. Almost all programming languages work the same way, using if statements, functions and so on so once you've learned one, it's easy to learn another.
Java is a excellent starting point for learning how to program. Once you've understoof how Java works and how even programming works, maybe move onto a different language and learn that. Or you could stick with Java and expand your knowledge of it as there is always something to learn
Hope this helped :)
+codelyoko373 Yeah I started no long ago and it was the same, nothing made sense...now it's making a little more sense. it;s what you are saying. Keep going learning and memorizing as much as you can until you understand how it works. Although school would be the best option for you mtn and all those trying to learn programming. I can't wait to start college on this!
Believe me, it's worst if english is not your first language and you have to watch the tutorials anyway...
PD: I do it because i love how bucky explains so easy all this.
***** No, Java is a good programming language though not as good as a language such as C#. I decided to switch to C# just so I could start using Unity.
Running program
Enter name of first gf here :
None
Your first gf was None
T_T
grason minguez java pls y u do dis ( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)
grason minguez just put if girl name = none then sop (" Get a Girlfriend Dude");
hahaha!!!
If I can get a really good understanding of Classes, Methods, and Objects/Instances then I think I will be good to go for Java. Im so used to non object oriented programming that I am having a hard time really grasping this concept. Im used to writing one long and big program instead of writing small mini programs using classes and objects.
Since 2009, Kelsey probably already came back.
+Olawale Jimoh XD
yeah she came
If any of you were confused by this video, don't worry. He confused the hell out of me too. String is simply a group of characters (a b c d) strung together. So String girlName, girlName is just the variable. He is using this thing called 'camelCase' which you can google. It is the process of capitalizing the second word in the string, but not the first. He however, failed to mention this, which causes a great deal of confusion when you begin to wonder, 'What the hell is with this weird notation he is using?'
Additionally, in line 3 of tuna.java, 'public void setName(String name)', he is again using camelCase to define another variable. setName is the name of the method, and inside that method is a string variable called name. He then finally sets the variable name inside of the setName method equal to the string variable girlName.
Didn't understand this when I was learning programming. Now after a year makes more sense.
meanwhile Kelsey be like "What is the point of using static keyword in main function?"
If you are having troubles with these videos making sense try watching the entire video without touching eclipse just trying to understand how everything is working. Then, watch it again while copying what he does into your own eclipse. Then after that try and do it without the video running. It worked really well for me.
For those who got the printf errors, I added "import java.io.PrintStream;" before the tuna class and it worked fine for me.
How
That is a great point you made there,sir.I am beginner just like 99% people here,and since i couldn't even grasp this code after first viewing (mainly because i didnt understand the point of it,or atleast why it is so complicated) i started to write things down,color code connected pieces,and step by step i understood what each thing does.
Can I use variable String myImaginaryGfName instead?
No, if you have no girlfriend you should stop programming
lol
If that is the case then about half of the programmers on earth won't be programming anymore....
The whole world rely on us we can't just quit.
what is difference between void and String? what does return does in getname()? please help?
theres a lot of things in this video i will definatley have to watch it several times
This is easier to understand if you have a C background. \m/ :D
same lmao
45 dislikes to many, i don't see why anyone would dislike these tuts... they are all perfect and explain exactly what you are trying to explain.
i dont understand how temp just becomes the name variable. Is it because its in the same position in the bracets are name?
+Adam Cole Using the setName method of our tuna class, we set the name of our first gf to temp variable. Then when we use saying method, it gets her name by calling the getName method inside it.
The string variable "temp" is being passed on to the parameter string variable in the setName method of the "tuna" class called "name". "Name" is then being passed on to the private string variable outside the method called "girlName". The "getName" method returns whatever value is contained within the "girlName" variable, which is printed out when the "saying" method is called in the main class.
I know that probably sounds extremely confusing to anybody that is relatively new to the language, but keeping working at it and listening to the tutorials very carefully. It will start clicking into place eventually :-)
Mad Mental Hibby I don't understand the part about returning girlName- where is it brought to and where is it returned?
+Danny Semakov - String temp = input.nextLine(); temp is assigned with whatever user types on kb.
tunaobject.setname(temp) temp is passed on to method 'setname' in tuna object. Then this is stored in girlname. Value in girlname is returned to apples which then executes method 'saying' in Tuna. When you see setname(temp) it means execute method setname with parameter the value stored in temp.
It's also recommeded to watch the advanced tutorials too.
Believe me, you need it. (I needed it)
Ahhhh this one was so hard! I agree with Lord Farqwhad, the first 14 videos were really easy, I got them instantly, the 15th video I had to review it and play around with it, but this one....gah
I understand this all perfectly...remembering it perfectly on the other hand is a different matter all together.
3:25 "Go ahead and copy that. Ahh i am going to just type it out." lol
Thanks for sharing with your method of obtaining knowledge. Everyone does it differently - I generally repeat everything what he does and after that I draw a logic map for myself to have it before me which helps me to get an in depth understanding of what is happening when I write this or that block of code.
When I go and type the
public void saying() {
System.out.printf("Your first gf is %s ", getName()); }
the program tells me as an error, and I quote, "The method printf(String, Object[ ]) in the type PrintStream is not applicable for the arguments (String, String)", but when I go ahead and replace the printf with println, it works perfectly fine. Any idea how I can fix it to work with printf and %s?
Edit: I solved it. If anyone else has the same problem, go to the Project > Properties > Java Compiler and check out the JDK Compliance, and set it to atleast 1,5.
Is there any particular reason Eclipse comes installed with it being set to 1.4? I had the same problem so I just used println but I was also curious why it wasn't working, so thanks.
I'm not entirely sure myself, I just googled the same error I got, and wasted a couple of minutes of my life to find that someone already had the same problem, and just corrected it. Glad it helped, cheers.
For those having difficulty reading Bucky's code:
Step 1: Separate every line of code with a newline
Step 2: Group similar lines together (for example, the defining of objects like tunaObject and input)
Step 3: ???
Step 4: Profit
dude i am completely lost in the last two tutorials O.o
never explained printf
Zarif Aziz yea :/
this like my only resource to passing my midterms for my computer science classes
Ah really. I'm heading into university this February (Australia) so these courses are just for me to see whether I like programming becaue I'm considering it as a major.
I recommend you start with C# or even a markup language like HTML before u get to the actual programming, i started with C# and i can pick up java in a blink, because most of the syntax is the same :)
Jurriaan Buitenweg nice! thanks i'll actually consider that :))
I just wanna drop a big thank you to you again. You might not get into technical details for most of your videos and use easy exemples, but this make it easy for beginner like me to learn compared to lots of tutorials online!
What is the function of return
+Prakhar Satyam Basically, it just sends data back from the function. If you were to use"tunaObject.getName()", you would get girlName, because that's what the function returns
+wessltov thanks
what is sounds like it basically a print statement
I know this tutorial is a bit harder than others but guys practice it properly you should get the hang of it! Thanks bucky!
who needs teachers when i've got Bucky .. thanks man !! ( "she was a babe " lmao :'D )
I know this isn't optimal code for the program objective, but this is actually a very good tutorial. I had to write down the code on a piece of paper and figure out what each method was actually doing, but I got it eventually. I definitely won't forget it.
What was the purpose of Public String getName(){ return girlName;}
i tried without it and it worked fine
can anyone help
returns the private value girlName
Alex Speedy It returns the value. Not variable.
Lazic B. ah sry for mistake xD
Alex Speedy Lazic B.
Thanks for Help guys
Lazic B. So what does returning value really mean?
Guys , if you have problems understanding in the first day , try next day , it worked for me. Just analyze everything bucky said and wrote and you will get the logic of the system.
why do we have a getName method?
+Muaz Mohamed So other classes can see what's stored in the girlName variable.
+paulmedley so if we want other classes to see the girlName, why not put it in a public method in the first place?
+Nitish Nayar because if it was a public variable, other classes would be able to change the value. This way they can only read it unless you add a mutator method
+paulmedley alright. got it. thanks man 👍👍
+Nitish Nayar this data-hiding concept is called encapsulation you can google it (as well as other OOP concepts)
I'm just learning this RIGHT now (watched the video for the first time just now), so hopefully a beginner explaining it is a good way for other beginners to understand it.
So what happened to Kelsey?
2 years later and still wondering
I had a hard time learning this until I got to your page:D
Too complicated to understand! I've watched it by far for at least 7 times. Nice video, though.
Try it out for yourself a few times, it will help!
Don't just watch the video, but try different variations of his code and try to understand what you did :)
Just follow along with tutorials as long as they don't give an error. You will understand in next couple of videos.
just copy the code to your compiler and try changing it over and over again according to your liking. easy as fuck
Not only that, but there may be some genius going on here. I'm betting he know that this question would get asked, and that almost everybody here is a beginner. This means that some of us will read and increase our understanding of the code in order to answer the questions of the other beginners as well. This increases the knowledge of everybody involved.
"She was a babe."
Lol
I'm glad your voice is clear and loud, and you're good at explaining :D
Is Pillow could be a Girl name?
These are great tutorials. this one made me realize that I will need to practice a lot because it's difficult to remember how to call things and why we structure things certain ways. when I try and do it without looking at your code i make a lot of errors so i have to go back and see how you wrote it.
I feel like this may be an over complication of the purpose of this video. The purpose is to store a user placed name inside a variable for future use. So if he puts in that his first girlfriends name was becky, then the program will respond with "your first girlfriends name was becky"
However, there is a much easier way to do this using a scanner and .next line.
EX:
import java.util.Scanner;
class file1
{
public static void main (String[] args)
{
Scanner scan = new Scanner (System.in);
String gf;
System.out.println ("Input the name of your first girlfriend");
gf = scan.nextLine ();
System.out.println ("your first girlfriend was " + gf + "");
System.out.println ();
}
}
Bucky, I have mastered all of your java tutorials up to this point. This one is extremely confusing for a beginner like me.
I think splitting the tutorial in separate sections or videos would be great as well as taking this all slower and explaining more clearly of what each thing does.
I see you know it so well that you just fly through not thinking so much about how much people like me understand it.
Other than that great job!
I understood all of your Java Beginner tutorials from part 1 to part 16 but I don't understand any of this.
I thought I was the only one! This lesson just escalated quickly
if you actually want to get a good understanding of this, try some codeacademy tutorials for python, they teach you the basics of programming, and it helps ALOT. I tried doing java about 1 year ago, gave up around here because progress was 0. Went to codeacademy to learn some simple python, and now everything makes a lot more sense, only the syntax is a bit diffrent. Python is really easy to use and will get you used to object oriented programming, dont give up :) and if you already have, then i hope you will at least attempt it once more.
Trust me I never give up! I just skipped it and just let time pass by and see next time if u understand it. Turns out it did. I completely understand the lesson. I'm on 35 now
Michael Gallego Thanks for the suggestion. I have decided to finish learning web languages first before resuming my Java lessons
You need to read it to. Find some books or online edition and read about those stuff. It is easy, just it can be confused in beginning - why that is here, why this is here, how that return there,... :). And try to type this code in your way several times and in every line type a comment // this line mean...program doing this and that....
I watched this 4 times in a row, and now I understand "little bits of it" :D
thenewboston this one is really confusing...
Saw this on Stackflow that helped with printf problem "I'm sorry about my previous post saying I had the same problem, I didn't read the "before you post read this" dialog box that says don't do that. Well, after a lot of time looking around for the answer, I figured it out myself. In Preferences->Java->Compiler box, there is a button in the top left corner called "Configure Project Specific Settings...". Click it and either change the compliance level to >= Java 1.5, or turn it off. Boom, fixed.
"
I lost you on this tutorial.
Download the book Java how to program 9 edition(paul deitel). and read the chapter 3. it has a similar example like this. and one SUGGESTION!!! READ SLOW FOR AVOID CONFUSE is not literature ...is programming :D cya i hope i help you
.
Emilio Mota Does it Really say "Read slow for avoid confuse" literally?
This is great as it teaches good data encapsulation from the beginners level.
Why not just do this:
public void saying(){
System.out.println("Your first gf was " + getName());
}
I tested it... It works the same.
True. but I believe he was just trying to show how the methods interact with each other and basically put multiple methods in the same video to explain better...
Although i also use that method it is a lot cleaner to use the printf as you can do;
printf("Hey %s, How are you %s", string, string)
Rather than;
println("Hey" + getName() + ", How are you" + getName());
There are many ways to solve a problem. What's your point?
Thanks for pointing out the obvious. If you look at the title, Bucky is giving an EXAMPLE of using many methods and instances.
if anyone facing a problem with printf
Error Saying:"The method printf(String, Object[ ]) in the type PrintStream is not applicable for the arguments (String, String)"
Thats because printf was added in JDK 1.5 release.
How to solve it:
You have to ensure that you're using a JDK 1.5 or above, and it is editable.
Go to the Project --> Properties --> Java Compiler and check out the JDK Compliance, then change it to at least 1.5
Thank You!
Thank you so much I had no clue why I kept failing when the code is exactly the same. I hope good fortune finds you!
Is it just me or there is a lot of redundancy in this code that is probably more suitable for more complicated applications?
+Sinehmatic It is made that way on purpose.. we can easily make all this in two simple lines inside the main function. However what he is trying to show is how to use multiple classes, and multiple functions or methods at the same time. How to play with them which will later allow us to build more complex apps.
i amsholls Yeah I understand that, I was just wondering if what I said was _also_ true
+Sinehmatic I think so, but I think that this comes about as part of the nature of Java and Java programmers, seeing as it was designed for more complex applications, and most people would use it for more complex applications, so teachers like bucky would just be used to writing it in this way
+Sinehmatic That was my first thought too. But I guess since this is a beginner's guide to Java, he is giving simple, easy to understand examples but also showing us how to do different stuff ( in this case multiple methods)
My god man you are the best at explaining. Evrything is so clear!
fuckin hell ive lost track of absolutely everything now, what the fuck is going on here!?
And there are lots of us here with the same issue...It cleary means , he overlooked some of the stuff, and took it for granted that beginners will understand certain things and went ahead.
thanks bucky, i understood it, i played around with it and i created many examples but it takes time to master i replayed the video many times.
15 tutorials yesterday and only this tutorial today :O
Schtring
@ lacus1122 :
1. The keyword private, when used on an instance variable or method means that it can only be used inside the class in which it was declared for security reasons and stuff like that
2. Return is a statement which says what the output of the method is, which ties into ur last question:
3. void simply means that the method has no output and therefore doesn't need a return statement, in the method head u mentioned, the output declared was a string, which is what the method returned
But I never had a proper girl friend:(
Robert Haxor lol same, I put down. Forever alone lol
Proud to be Irish Forever along :(
Robert Haxor lol
Proud to be Irish What is it like to be Irish?
Robert Haxor good, weather isn't always good but in Galway, people are good and life is good, average house for a family of 5 :)
Come here on holidays some time :) you'll enjoy dublin's Tayto park! (The potato chip company made it lol)
I saw a few comments about people who didn't know what's going on. I'm a beginner too, but I have the feeling I can help.
*girlName* is a private variable of the class "tuna". This means, it can't be used in any other classes (in this case apples.java). This means you need to add methods (methods are just like functions, with the addition that you need an object to use them) to work with the variable. You can't just change or print it by using the variable, only the methods from that specific class have access to it. What you usually need to do is like this
1) make setter/getter
2) create an object >>>tuna tunaObject = new tuna();>tunaObject.setName(temp)>>System.out.println("Your first gf was " + tunaObject.getName());
What do I write if I never had a girlfriend ._.
Write best friend instead
kooskotopia What if I've never had a friend before?
DarkYogurt Worst enemy/ Most hated person
kooskotopia What if I don't have one of those?
For the people who does not understand all of what is being explained in the video or in the past videos, i recommend a book that is called "How to program in JAVA" by Deitel & Deitel ; in this book it is explained all about java (variables, loops, methods, classes, instances, etc.) i recommend this book as a complement to the videos :)
What if I don't have a girlfriend? I can't fill in anything.
Feelsbadman
yeah bucky! what if we dont have a gf
Did that work?
I'm learning java with these videos myself too. The confusing part for me, was temp too. What worked for me was, try to write tut 15 on your own without help of Bucky. It was very hard, but now ie understand things better.
Huib from Holland
my girlfriend is in the room so i change girlName to sportName to not make her angry
you're the best bucky! also, the humor totally helps. thank you for these epic tutorials. cheers.
she was a babe ^ _^
Thank you bucky. Your videos are very helpful. I have learned a lot from you
You just made this incredibly hard in comparison to 15. I mean feels like this should be 19 at least !!! I just can't understand why we need private String girlName; !! and for example let's say I don't want that line of command .. I want to execute this program without the private String .. how can I do that ? exactly the same thing .. just without the private String .. I can't figure it out ! can anybody help me ? please !
***** Ok i will try to answer you, actually the private value isn't really necessary in this small program that he made, when it becomes important is in bigger programs where the private method is a way of handling complexity, a private method can only be accessed from inside the same class, so if something goes wrong with that, there is usually only one source file to look at. If you have a 100 lines of code in your project but your classes are kept small, this can reduce your bug tracking effort by a factor of 100.In the program he made the other classes don't need the girl name it only needs the out put which is " you first gf was ex", i hope this helped
sahraoui sidahmed Ty for the answer .. No you didn't understand, I understood the difference between private and public methods ... I just didn't understand why the program won't work without that "pirvate String girlName" instance ... I know he did it for the purpose of teaching .. but it's redundant in this case .. so I was trying to make the program work without it .. and I just couldn't .. how can I make it work without that instance .. that's my question !
***** And yes it exactly the same thing just with out private String, remember there are multiple ways to do something in java, i really hope this time i answered your question if not tell me
***** I feel the same... its so complicated...
+Aashray Tattva Das I found it easier after some more practicing on the previous tutorials
the sound is horrible but the best java classes I've seen so far on youtube. thanks
am i the only one who finds this tutorial a bit confusing and tough(ugh! i feel dumb)
hmm
The Skipper (continues trying)
i am struggling with gui now
thanks bro! i am quite stubborn, i dont give up easily
ya thanks
Okay, I am coming from episode > 30, and trust me, this makes so much more sense now. My recommendation is to try and understand as much as you can regarding this, then move on. The next few episodes aren't so bad actually.
If you do have problems with the little program, just replace the printf and %s statement with System.out.println("Your first gf was " + getName());. Worked for me though. BTW try to type in syso, hold ctrl and press space. Thank me later. Great tutorial so far. Big ups mate!
Thank you bucky for teaching hope to see you in the next video
Bucky thanks for all the work you put it in to teach us, has really helped me out a lot !
I hope you get something good in return for your hard work.
It is good practice to make all of your class variables private because when you have a ton of classes you won't want to get variables with the same name mixed up. He names the variable "temp" only to show that it is different than the private variable in the tuna class, but naming "name" won't make a difference, because the variable "name" in the tuna class is private. Hope this helps!
You had to say that @ 5:53, didn't you? Man it's amazing to have such a complete package free of charge! I'll be proud when I make my first donation, although I'm well aware that subscribing did add to your statistics.
where were you when I was an undergrad student struggling with java back in 2007 :"(
ure the best I swear
Typing syso and then pressing Ctrl + Space will give you System.out.println();
I highly recommend adding a System.out.printf("", arg1); shortcut to Eclipse.
Go to Window -> Preferences -> Java -> Editor -> Templates -> New...
For name, type sysf
For description, put whatever you like
For pattern, type System.out.printf("${cursor}", arg1);
Now you can just type sysf and press Ctrl + Space and it'll give you System.out.printf("", arg1); with your cursor inside the string!
:D
10 years , still useful
Thanks man, I was doing terrible in programming class but you helped me understand everything a lot better!
@NGCoderHD, good question. Although creating the getName() method is not required in this particular program (if you omitted it, you would replace the getName() with girlName), creating a method which returns the variable is good practice if you ever create programs with multiple classes. The getName() method allows for better organization, and allows the user to access the variable from another class.
Watching this at New Year 2019, still very helpful! Thanks!
Had to watch this a few times to understand, but dw guys, don't give up, you'll get it in the end :p
Thanks again abit confusing but able to figured it out by the comments I wrote down. Really like your tutorial barky. Great thanks!!
Bucky not Barky... U is far from A on most keyboards so i know that wasn't a typo.. everyone knows it's Bucky
The first 16 tutorials were very helpfull to get me started. But as we have prgressed i noticed that the way bucky teaches is not good if you want to go very far. It will just get you started. If you are totally new to java programming i suggest reading the book "Java for Dummies" Learning from it and the coming back to this video helped me alot
Bucky. I know you have like 300,000 subscribers and over 3,000 videos, and this one is old so you'll probably ignore it and ignore this comment too. But if you do happen to read this, I just want to say that these tutorials are awesome. What you do is very good. You provide people with the knowledge to program and then maybe some will go further to make games and make money. I am learning Java to learn Slick to learn OpenGL to make games. Thank's bucky! You're the best! I'm sure others agree too
It took me a couple minutes of extra thinking to figure out why things were happening, but an easy way to explain it: tunaObject.setName(temp) is used to tell your setName method to grab the information in the variable temp. setname now has a value for setName(String name), so that name variable is now whatever temp is (and temp is getting its data from input.nextLine from the scanner). Now that setName has a value for name, girlName=name; has a value to set girlName to.