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

Link to this comment:

Share to:

All Comments (778)

Sign In or Sign Up now to post a comment!
  • Dude i gotta say, I love your java tutorials. I am a Web Developer and I Needed to learn a destop Lenguage and decided to go with Java. Just by watching your videos I learn a great deal. Thanks a lot for this great Job. Keep it up!

  • First of all, thank you very much for all of the videos. It is much easier and fun to follow your teaching then the one of my professor.

    So, my question is why do we have to use 'girlName' in the beginning of the class tuna? Why can't we just use name? I ran the program without 'girlName' and it returns 'null' in the spot where the actual name should be. Can you please explain this? Thank you

  • @veric1525 String name; public void setName(String name){ } public String getName(){ return name;

    That is how i did it and it returns 'null'. It is just hard to understand why does it work this way so if you explain it to me it will be easier to remember. Thnx again

  • wow didn't know you could put a variable outside a method xO

  • Also better known as java's getters and setters

  • @Confused go back to tutorial 3 and start again :D

  • Always learn an easier language before you try the hard, I learned Lua before this, they are very similar. Minus a few minor detail.

  • Is not very hard to understand just sit down on your chair and focus what bucky is doing and you will understand and don't forget to use your brain :D

    Allah bless you Bucky

  • ahhhhhh......my old friend "printf".....this is becoming more and more like C++ :)

  • I have understood all so far, I just can't remember the code to put it to use.

  • This is actually better than alot of my school teachers....and its a youtube video XD

  • Dont thank us for watching.

    We thank you for this videos!

  • It's the accessor and mutator

  • ok i stil dont get whats return type, what does it return??? and whats void what doesn't it return????

  • @delgadogorn Void means that a method doesn't return anything. So RETURN cannot be used. This is great for printing messages. Returning an item means the exact opposite. You need to return something (aka an int, String, or whatever). This is best used for calculations like:

    public int simpleAdd(int num1, int num2){

    int answer;

    answer = num1 + num2;

    return answer;

    }

    Now when this method is called in the main program. It will return that answer to those added values. Hope that helps.

  • @slowblo i still dont get it,"return" what?t, if you do "return answer" whats is that? were does it put it or watever?

  • @delgadogorn when you start your method if it says public static VOID ... or public static INT or public BOOLEAN, then you are returning VOID or INT or BOOLEAN; they are the return types. and void doesnt return anything. that means you dont need a return statement. thats why the method (setName) doesnt have any return statemetns.

  • this video is slightly confusing for me..i m not getting into it..

  • Ashley

  • Comment removed

  • why we have to use ""public String getName(){

    return girlName;

    }

  • enter name of first gf here:

    Minecraft

  • Comment removed

  • thank you for helping me . you make it easy

  • public string getName(){

    return girlname;

    }

    i dont get why u did that. was it necessary to put it there? if so what does it mean?

  • Comment removed

  • 26 bugs so far

    

  • if your confused just practice this until you know what it means, and dont rush yourself

  • 26 wankers disliked this

  • I don't like how he reffered us to see his c video to get what printf does Why didnt he explain it.

  • @idk6752 you should say thank you, this guy is a legend

  • I to did understood it, although, as a non-english, speaker sinds my birth, it took me a while sinds I understood wath the return does, maby you should explain that a bit more.

  • Ok I understood this, but next time you shouldn't use the name tuna and apples with this. This kind of adds to the confusion a little, people want an example of what they should name their variables, methods, functions, etc.

  • I'm traped here.

    I can't understand some ... do I have to learn C language to understand this tut?

  • @metalnala -.-

  • Comment removed

  • Glad to know I'm not the only one struggling with these. Hopefully it will make sense after a while.

  • you can do this so much easier in c++... my brain hurts now aghhh!!!!!

  • @pancakesimone no... c++ is just les logical and more straight forwards. :P this is just pure logic. change how your thinking about it and it will make more sense ^^

  • I got really really high, then watched this. I didn't get confused. You just forgot to get high! :D

  • this is the first one i got confused on

  • DX such a roundabout way of doing it! Confused me, I hope he explains a little more next tutorial.

  • I dont understand return type.

  • Comment removed

  • Couldn't you just use the method from tutorial 15 to do this?

  • @Weini123 Yes you could do that but the point of this tutorial is to teach how to use multiple methods

  • Ok is anyone else confused... i was fine before but now I'm totally lost

  • @bennerv94 just continue on with the tuts, we dont use this function for atleast another 20-30 tutorials (:

  • @bennerv94 same

  • @bennerv94 This tutorial is all about is designing a class and making use of that class by creating instances of it as objects. He's designed his "tuna" class (a better name would have been "Girl") so that it contains data (the name of a girl) and methods (things to do to that data). The "apples" class creates an instance of "tuna". What that means is that it creates a girl, and then does things with it. Think of what he did here like making a baby - he created it, then he named it :)

  • @dragonthewatcher What does that mean? I wrote that comment in hopes to clarify what is going on in this video. If that comment was unclear, perhaps I can try to rephrase it.

  • @TheBlackDeath3 creates a girl, and then does things with it

  • @dragonthewatcher So are you making a less-than-mature joke, or does that statement confuse you?

  • @bennerv94 your mind must not be logical..

  • @bennerv94 Haha the funny thing is this is exactly why I started watching this line of videos. The lesson I'm on in my JAVA college class has me quite confused on this topic and I needed some 3rd party help. This is Chapter 3 in my book IRL so that gives you an idea of how complicated things get quickly.

  • @bennerv94 how can you be confused he makes it so easy

  • @bennerv94 learning programming is different. I find if you get lost, it's often best to go on, but rewatch this at a later date. Sometimes you'll have learned something else that'll make this just sort of "click"

  • @bennerv94 just watch it again... I love this...

  • the variable should be private bucky

  • here is what i did: System.out.println("Your first gf was " + girlName); im so awesome :D

  • "all it does is return girlName which is made up here" where does it return it to? And why return girlName instead of name, what's the logic lol?

  • man this is confusing, why create variables inside a method?, why is that a good thing?, why create the temp variable?

  • My brain hurts

  • WOOW i Was at tutorial 15 and then when i switched to 16 i didn't notice that i switched to Intermediate 16 and when i was done with that one i switched to intermediate 17 and then i noticed it and i was like phew because it was SO HARD!

  • omg i finaly got it!! pin drops, omfg finaly, i did like 30 more tuts after this and came back to it <3

  • My output was:

    your first gf was Handgelina

  • Yeah this was really confusing.

  • What does the '%s' thing mean? That's confusing me.

  • @GeorgeUnitt the '%' means it will be replaced for a variable, the 's' stands for string. so a '%s' represents a string variable. after you've written this you give the name of the variable it wants to use or a method name which returns the string variable, e.g.:

    "Your first gf was %s", String variable name/method name (which returns the String variable).

    This takes user input and uses it in the output, as opposed to just writing "Your first gf was Amy"- which would be the same for everyone.

  • i love how the joke here is that there's no any girl programmers xD

    and if there is no offence well bucky said that not me xD

  • i used the name of my best friend becasue my last girlfriend ruined my life and made me do some "Bad things" that ruined my life even further and thats why im here relearning java...

  • I dont have a gf so i putin my name there :P

  • Did you use the method getName at all, if not why do you have it in your class tuna

  • @slim2kev Yes he did, he used it in the saying() method to print out the name that has been entered before.

  • the new trick is we can define a method and define a string by the same ie.public String getName() as he done in the tuna class,thumbs up so everyone can look

  • I really did not understand this lesson. Well I guess I'll learn it later when needed.

  • I never understood why 'arguments' was named as it was. Same with 'pipeline'. Most of the time, computer science terminology has a pre-existing thing from which they constructed the name.

    Arguments just seems like it's not the right word...

  • @6dark6alex6 Computer science partly stemmed out of formal logic, therefore it borrowed much of its terminology. It is all Aristotle's fault.

  • for first gf I put hand

  • Enter name of first gf here:

    - eclipse;

  • Great vid man, could you explain %s? And for the private variable, if you can set / get the methods-> variable is there a point to make the variable private? + if it was a public variable how would you use it from another class?

    The import scanner, that is just another class in a different location right? Would I be able to import tuna as well? and If I imported system.out could I just use println without typing it all out?

    Keep up the great work mate, slowly getting through the vids.

  • @Ansego777 The import Scanner is just a set of information from Java. It allows you to use that function. You're talking about setting a new function for a print line, which I'm sure he'll go over. You create a new function and give it parameters, and then use that function name.

    %s takes the argument string that you have told it to. It's similar to putting: ("Your new girlfriend is " + name) in the system output, where name is a string you've created.

  • time to watch like 100 vids...

  • I am in love with how pretty codes look! ^_^

  • shittt i never get the Object and the String thing..........and this is only the 16th tutorial -__-

  • yea same, i dont understand this either. i dont understand why we need to return a name? and i dont understand why we need the private bit? please bucky help. :(

  • Comment removed

  • @Cobezzz He made the girlName private because he doesn't want any other classes to access that method. You need to use private when you want some data hidden, this is called encapsulation. For instance, you are dealing with bank accounts, you don't want your customers account to be accessed by anyone but you. Also, we need to return the name because if you're getting something, you must return something. In this case, you are getting the name, therefore, you should return it as an output.

  • @shantty1225 thanks bro, that helped a bit, i've gone over the tut a few times and made my own variable and am understanding it more and more, thanks for telling me the return function basically refreshed the old variable :) made more sense too :)

  • @shantty1225 Hey i am new to java, i had the sme question like Cobezzz and i would like to ask you: If we want the clas to no nothing about the girlname, sd should make a method from tuna class that scans the name, coz now the name of the girl is in the temp variable so it is not concieled from apple class. Am i right or i miss something?

  • I don't understand this... I was understanding everything up until this.

  • I thought Bucky was going to say 'She was a real bitch!'

  • Hey, the output doesn't work... wait

    Forever Alone level: Java Programmer

  • Hello Buddy!!. I'm learning a lot of with your videos!!. Good job... I have a question for this video!. In the class tuna you can do this because you don't need the method, thank you!

    /*public String getName(){

    return girlName;

    }*/

    public void saying(){

    System.out.printf("Your first gf was %s", girlName);

    }

  • Thanks Bucky, everything I now from programming is from you!

  • Thank you , you have helped me so much 

  • Error:

    "The method nextLine() is undefined for the type input"

    Solution please?

  • when was the getName return thing used?

  • @IamJacksColon4

    it was used on the method just below where it says ("Your first gf was %s",getName())

    by typing getName()) he gets the value that the function returned which in this case is the variable girlName which in turn is the name input by him "Kelsey"

  • @IamJacksColon4

    although i dont know for what purpose he created getName in the first place....the way i see it,it is of no use,but im no expert :)

  • @DevilOnHog It is of use. See because girlName is a private variable, you need a way to access that variable outside it's class(tuna).If apple wants to get access to girlName, it needs an accesseor method which returns girlName(the getName method).The reason why the accessor method is public is because you need it to be available to any class you want ,even if the class is in a different package .

  • public void saying(){ System.out.print("Your 1st gf was " + getName());

    tis is java type of code

  • Tip: Try using your own names and variables. In stead of "temp" use something you more easilly remember. This way you learn how it works without doing excactly the same as Bucky, and you might learn quicker.

    Hope that helps!

  • Lol, the views have increased from the last tutorial, why would people skip them? D:

  • @123JimmyTheCookie

    Because i used to watch another persons vids before this. And I already knew the stuff from before.

  • @123JimmyTheCookie because the harder tutorials people want to go back on and revise so they understand better which = more veiws

  • Seems rather a roundabout way to get a response...compare to lessons 4 through 7 maybe... I'm not sure why I would want to do something this complicated...obviously Master Bucky isn't revealing the full extent of the power of this spell....

  • lol

  • That program is overcomplicated.

  • This program isn't going to output anything for some people....

  • @TheNotch3000

    OMG HOW DID U KNOW!?

    This isn't outputting anything for me!

    But it says I have no errors and it looks exactly like his!

    I use NetBeans IDE 7.0.1 though, but I am not sure if that has anything to do with it.

    Pls help me Bucky, and TheNotch3000!

  • @thejord1000 I did take a look at it... Did you write "%s" as in "Your first gf %s"?

    I did and suddenly it worked...

  • @TheNotch3000 lol! XD

  • @TheNotch3000 Yeah... =(

  • @TheNotch3000 like yourself?

  • @Cobezzz Maybe...(Yes)

  • @TheNotch3000 Why, because we're 10 times more skilled than you at a fraction of the age?

  • @16skittles16 Your name tells me your 16, I'm 15... It was just ment as a joke, not to offend people.

  • @TheNotch3000 Actually, no, that's just my number in sports.

  • mattmanwatson14

    Maybe in the main class, you didn't write public static?

  • im getting the error that my Method: Saying is non-static and needs to be referenced as a static Method. what did i do wrong

  • I got an error on Java line 4: Scanner cannot be resolved to a type.

  • @MysteryMan3014 You have to import it.

  • kelsey watches this...

  • @TheRealMeedon so you are a boy!

  • Comment removed

  • Can't ya just do tuna.ssayorwhatever(scannerthi­ng.nextline());

  • @goeiecool9999 This tut is not about the fastest and easiest way to do crap, but to learn things.

  • @MrStropwen, cause you can create variables such as Scanner scanner = new Scanner(...), for people that are lazy or are unoriginal, anyway eclipse should correct you when you go wrong :P

  • eehm... i do not untherstand the private varible... :s

    

  • @Arno18Production basicly, it means that only methods inside the same class can use that variable, but i don't really see the meaning of using it :S

  • I have a question if anyone can awnser why do all S''s in java case sensative ? just curious

  • why make the string "name" to change the "Girlname"? why not just make that variable public, and change that directly?

  • @SathApoc the method public*

  • @SathApoc I was wondering that too seemed tottally pointless

  • My first girlfriend was Derp. :D

  • @Kiazer45 WHAT ISA DERP?

  • thanks :)

  • Can't you just do the same thing as you did in the last tutorial

  • NVM, i just noticed that there was a call to getName() Method, thx anyway :D

  • At 5:38, he didnt call or use " getName() " method yet the program knew that " getName() " method was " girlName " variable, can someone explain it for me plz.

  • @drakion1989 Yes he did...look at the public void saying() method in tuna.java

    he is using it inside the System.out.printf

    When he uses this method in main the getName method runs automatically inside saying.

    I hope this makes sense to you...

  • @Rapido7788 no cus then the computer doesnt have a name

  • ...can I just use girlName in the saying method instead of using the getName method?

  • @Rapido7788 No because the word "get" is the key to getting the name

  • confusing shit! D: Thanks Bucky<3

  • 23 people never had a gf

  • @CodeSensitive lol how u get that figure?

  • @CodeSensitive the akward moment when you laught of a comment but then realize you are one of them :'(

  • I do not understand these, can someone please help:: Void, String, args, return, tunaObject, setName, getName

  • @Alaynia100 Watch tutorial 3-16 I believe you'll know what void, string, args, return means, tunaobject is just to use 2 classes which you need a main class and then take the info from the 2nd class. pretty self explanatory, setName and getName are just some variables.(to store shit in them). need more help? go to google.

  • What is the point of using printf over a typical print? Couldn't it be done just as easily with System.out.println("Your first gf was "+getName()); or as the user below me said, System.out.println("Your first gf was "+girlName);

  • @RileyAcoustic It's called an example. He is teaching you other methods in case you have to use it in another situation as what you are saying doesn't always work. These are simple methods in which you need to figure out how you can best apply, yes your works best for that method but in larger scales something like so would work better.

    I code in C#, at first simple things like what you are saying seems reasonable but when you go to make larger applications shit gets messy and errors appear

  • is the getName() method really necessary in this example? Couldn't you just put this into the saying() method and get the same result:

    System.out.printf("Your first gf was %s", girlName); I don't see a purpose for using the getName() method for this example.

  • Comment removed

  • This is SOOOOO focking difficult 0_o damgggg

  • Wouldn't it be easier to just store the user input as girlName variable via Scanner, and just output girlName directly in the main file? The get method and return is only making things more complicated.

  • @idiotrun1997 It is to learn us how to use methods.

  • lol my first (and current) gfs name was kelsey :)

  • @theysys13pwn With so many viewers it had to be one who had a gf that was named kelsey :)

  • @theysys13pwn Her name WAS Kelsey? What name does she currently go by, then?