Java Programming Tutorial - 16 - Many Methods and Instances

Поділитися
Вставка
  • Опубліковано 11 гру 2024

КОМЕНТАРІ • 1,8 тис.

  • @smnmtthws17
    @smnmtthws17 9 років тому +864

    "she was a babe" hahahaha best tutorials

  • @MrInsaneMixer
    @MrInsaneMixer 11 років тому +577

    I thought his first gf was Tuna..

  • @tehJimmyy
    @tehJimmyy 8 років тому +696

    System.out.println("Error 404 : No Girlfriend Found");

    • @afraid3776
      @afraid3776 8 років тому +4

      LMAO

    • @brusslee1814
      @brusslee1814 8 років тому +13

      OMG SAME ERROR HERE WTF?? ILLUMINATI CONFIRMED? Δ

    • @SSJfraz
      @SSJfraz 8 років тому +81

      *Creates a getGirlfriend method*

    • @lolmemes6543
      @lolmemes6543 7 років тому +71

      try to import java.util.Girlfriend
      lol

    • @HipHopEducation
      @HipHopEducation 7 років тому +2

      Lmfao

  • @The1995Malakas
    @The1995Malakas 8 років тому +290

    I lost my shit at the "She was a babe" part, hahahaha, you're one of a kind bucky!

    • @dhaferharrathi
      @dhaferharrathi 8 років тому +3

      +Γιώργος Φωτόπουλος same here xD

    • @locatingwizard4219
      @locatingwizard4219 8 років тому +1

      I was literally rofl i kid you not.

    • @danielk2122
      @danielk2122 8 років тому +1

      me too. I giggled :D

    • @cgme7076
      @cgme7076 8 років тому +2

      Haha same, that shit was funny

    • @wilkil973
      @wilkil973 8 років тому +1

      haha me too.

  • @KaranSingh-ty5xr
    @KaranSingh-ty5xr 8 років тому +158

    "She was a babe" -- Bucky, May 9, 2009

  • @kioupfkejd7170
    @kioupfkejd7170 9 років тому +46

    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 .

    • @OptimusPrime-mv7zg
      @OptimusPrime-mv7zg 9 років тому

      very nice explanation / can you give me your social contact please?

    • @OptimusPrime-mv7zg
      @OptimusPrime-mv7zg 9 років тому

      very nice explanation / can you give me your social contact please?

    • @jvr3092
      @jvr3092 9 років тому

      +kioup fkejd what if we set getName() to private since we only use this method inside the class? Would it be correct?

    • @ruben247
      @ruben247 8 років тому

      +Javier Hdz C yes, that is correct.

    • @patrasculucian2403
      @patrasculucian2403 7 років тому

      I think it's good to know that you can use a temporary variable

  • @rodolfobeguiristain
    @rodolfobeguiristain 8 років тому +255

    When I scroll down for help and instead am bombarded with "I don't have a girlfriend" jokes...

    • @kamaljain939
      @kamaljain939 8 років тому +1

      lol, every1 lost their mind on his gf

    • @Steady_OG
      @Steady_OG 8 років тому +26

      she was a babe

    • @prashantbasnet4615
      @prashantbasnet4615 7 років тому +4

      what is difference between void and String? what does return does in getname()? please help?

    • @rodolfobeguiristain
      @rodolfobeguiristain 7 років тому +9

      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.

    • @psis6786
      @psis6786 7 років тому +6

      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....

  • @Cylowatt
    @Cylowatt 12 років тому +6

    It feels so awesome when you finally understand it after a couple of hours of intense thinking.

  • @SupremeKingSovereign
    @SupremeKingSovereign 10 років тому +58

    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.

    • @jaybartgis5148
      @jaybartgis5148 10 років тому +2

      Well... do you have any better videos?

    • @SupremeKingSovereign
      @SupremeKingSovereign 10 років тому +1

      Jay Bartgis Programming Methodology (Stanford)

    • @aliceclanton7417
      @aliceclanton7417 10 років тому +3

      Yeah or just post the portion of code to stackoverflow. You'll get an explanation by the end of the day guaranteed.

    • @hossamnasser9717
      @hossamnasser9717 4 роки тому +1

      Thanks for this advice
      How have you been so far by the way ? :D

  • @Themostamazinguy
    @Themostamazinguy 10 років тому +50

    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.

    • @dastron6939
      @dastron6939 10 років тому +2

      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
      @Themostamazinguy 10 років тому +1

      StickWarpStudios What do you mean by "I can't use printf". If you tell me i could probably help.

    • @dastron6939
      @dastron6939 10 років тому

      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)

    • @Themostamazinguy
      @Themostamazinguy 10 років тому

      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.

    • @MsNikeNike
      @MsNikeNike 10 років тому +1

      StickWarpStudios Im having the same problem :(

  • @HristinaTsvetanova22
    @HristinaTsvetanova22 11 років тому +3

    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.

    • @aliasgharkhoyee9501
      @aliasgharkhoyee9501 3 роки тому

      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).

  • @TheConvicted0nes
    @TheConvicted0nes 10 років тому +20

    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.

    • @jaybartgis5148
      @jaybartgis5148 10 років тому

      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?

    • @bassdewd
      @bassdewd 9 років тому +1

      Jay Bartgis docs.oracle.com/javase/8/docs/api/java/util/Formatter.html

    • @jaybartgis5148
      @jaybartgis5148 9 років тому

      Thanks man. I was looking for that

    • @diksha5746
      @diksha5746 9 років тому

      It's just some comment. 😉 thank you

    • @youtubesfather9643
      @youtubesfather9643 5 років тому

      I thought "print the fuck"

  • @blazeaster
    @blazeaster 10 років тому +9

    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.

    • @clerpington_the_fifth
      @clerpington_the_fifth 4 роки тому +2

      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.

  • @Shaun-EZX
    @Shaun-EZX 7 років тому +1

    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

  • @codelyoko363
    @codelyoko363 8 років тому +17

    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

    • @ApleSkrutE
      @ApleSkrutE 8 років тому +1

      +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?

    • @codelyoko363
      @codelyoko363 8 років тому +3

      +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 :)

    • @GabrielMartinez-pq3rg
      @GabrielMartinez-pq3rg 8 років тому +1

      +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!

    • @juansierra9946
      @juansierra9946 8 років тому

      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.

    • @codelyoko363
      @codelyoko363 8 років тому +1

      ***** 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.

  • @GrayJune7
    @GrayJune7 9 років тому +205

    Running program
    Enter name of first gf here :
    None
    Your first gf was None
    T_T

    • @jakedean8284
      @jakedean8284 9 років тому +54

      grason minguez java pls y u do dis ( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)

    • @OceanWarsUltimateShowdown
      @OceanWarsUltimateShowdown 7 років тому +5

      grason minguez just put if girl name = none then sop (" Get a Girlfriend Dude");

    • @CesarDMarin
      @CesarDMarin 6 років тому +1

      hahaha!!!

  • @treyatl2006
    @treyatl2006 10 років тому +7

    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.

  • @olawalejimoh4408
    @olawalejimoh4408 9 років тому +99

    Since 2009, Kelsey probably already came back.

  • @jsx0328
    @jsx0328 8 років тому +3

    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.

  • @thecowmilk4857
    @thecowmilk4857 4 роки тому

    Didn't understand this when I was learning programming. Now after a year makes more sense.

  • @oprabin
    @oprabin 8 років тому +28

    meanwhile Kelsey be like "What is the point of using static keyword in main function?"

  • @imVix
    @imVix 12 років тому

    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.

  • @potlicious
    @potlicious 9 років тому +9

    For those who got the printf errors, I added "import java.io.PrintStream;" before the tuna class and it worked fine for me.

  • @WaKeVajZet
    @WaKeVajZet 11 років тому

    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.

  • @OlegSeroshtan
    @OlegSeroshtan 8 років тому +23

    Can I use variable String myImaginaryGfName instead?

    • @Steady_OG
      @Steady_OG 8 років тому +3

      No, if you have no girlfriend you should stop programming

    • @n.aclasheryt4802
      @n.aclasheryt4802 8 років тому

      lol

    • @ahmermirza
      @ahmermirza 8 років тому +2

      If that is the case then about half of the programmers on earth won't be programming anymore....

    • @OlegSeroshtan
      @OlegSeroshtan 8 років тому +1

      The whole world rely on us we can't just quit.

    • @prashantbasnet4615
      @prashantbasnet4615 7 років тому

      what is difference between void and String? what does return does in getname()? please help?

  • @vedi0boy
    @vedi0boy 11 років тому +1

    theres a lot of things in this video i will definatley have to watch it several times

  • @ttc_keeb
    @ttc_keeb 10 років тому +11

    This is easier to understand if you have a C background. \m/ :D

  • @chavyah5052
    @chavyah5052 11 років тому

    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.

  • @Born2EditHD
    @Born2EditHD 8 років тому +13

    i dont understand how temp just becomes the name variable. Is it because its in the same position in the bracets are name?

    • @miniapplem8192
      @miniapplem8192 8 років тому

      +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.

    • @SSJfraz
      @SSJfraz 8 років тому +2

      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 :-)

    • @FirstNameLastName-tc2ok
      @FirstNameLastName-tc2ok 7 років тому +1

      Mad Mental Hibby I don't understand the part about returning girlName- where is it brought to and where is it returned?

    • @aquamon17
      @aquamon17 7 років тому

      +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.

  • @IWolfGod
    @IWolfGod 12 років тому

    It's also recommeded to watch the advanced tutorials too.
    Believe me, you need it. (I needed it)

  • @JasonZhang611
    @JasonZhang611 11 років тому +4

    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

  • @Dimthegamer115
    @Dimthegamer115 12 років тому

    I understand this all perfectly...remembering it perfectly on the other hand is a different matter all together.

  • @dylannguyen1017
    @dylannguyen1017 9 років тому +4

    3:25 "Go ahead and copy that. Ahh i am going to just type it out." lol

  • @amnest1ac
    @amnest1ac 12 років тому

    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.

  • @brankoilic6927
    @brankoilic6927 8 років тому +8

    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.

    • @benryangarcia
      @benryangarcia 8 років тому

      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.

    • @brankoilic6927
      @brankoilic6927 8 років тому

      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.

  • @wessltov
    @wessltov 8 років тому +2

    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

  • @TheCaffeinatedDrive
    @TheCaffeinatedDrive 10 років тому +63

    dude i am completely lost in the last two tutorials O.o

    • @ZarifAziz
      @ZarifAziz 10 років тому +10

      never explained printf

    • @TheCaffeinatedDrive
      @TheCaffeinatedDrive 10 років тому +8

      Zarif Aziz yea :/
      this like my only resource to passing my midterms for my computer science classes

    • @ZarifAziz
      @ZarifAziz 10 років тому +2

      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.

    • @jurriaanbuitenweg4231
      @jurriaanbuitenweg4231 9 років тому +1

      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 :)

    • @TheCaffeinatedDrive
      @TheCaffeinatedDrive 9 років тому +1

      Jurriaan Buitenweg nice! thanks i'll actually consider that :))

  • @KarlHamel
    @KarlHamel 12 років тому

    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!

  • @prakharsatyam9354
    @prakharsatyam9354 8 років тому +11

    What is the function of return

    • @wessltov
      @wessltov 8 років тому +2

      +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

    • @prakharsatyam9354
      @prakharsatyam9354 8 років тому

      +wessltov thanks

    • @kkiwi8559
      @kkiwi8559 6 років тому

      what is sounds like it basically a print statement

  • @vectork3
    @vectork3 7 років тому

    I know this tutorial is a bit harder than others but guys practice it properly you should get the hang of it! Thanks bucky!

  • @mimitk6642
    @mimitk6642 8 років тому +15

    who needs teachers when i've got Bucky .. thanks man !! ( "she was a babe " lmao :'D )

  • @iamjoshkoopman
    @iamjoshkoopman 9 років тому

    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.

  • @TheLegendSpeaker
    @TheLegendSpeaker 10 років тому +7

    What was the purpose of Public String getName(){ return girlName;}
    i tried without it and it worked fine
    can anyone help

    • @zerogravity1119
      @zerogravity1119 10 років тому +2

      returns the private value girlName

    • @OverG88
      @OverG88 9 років тому +1

      Alex Speedy It returns the value. Not variable.

    • @zerogravity1119
      @zerogravity1119 9 років тому

      Lazic B. ah sry for mistake xD

    • @TheLegendSpeaker
      @TheLegendSpeaker 9 років тому

      Alex Speedy Lazic B.
      Thanks for Help guys

    • @TuhPuhDuh
      @TuhPuhDuh 9 років тому +5

      Lazic B. So what does returning value really mean?

  • @xrre5498
    @xrre5498 8 років тому

    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.

  • @muazmohamed7693
    @muazmohamed7693 8 років тому +5

    why do we have a getName method?

    • @paulmedley
      @paulmedley 8 років тому +1

      +Muaz Mohamed So other classes can see what's stored in the girlName variable.

    • @TheBlazR
      @TheBlazR 8 років тому +3

      +paulmedley so if we want other classes to see the girlName, why not put it in a public method in the first place?

    • @paulmedley
      @paulmedley 8 років тому +3

      +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

    • @TheBlazR
      @TheBlazR 8 років тому +1

      +paulmedley alright. got it. thanks man 👍👍

    • @oskarrynkiewicz1141
      @oskarrynkiewicz1141 8 років тому +1

      +Nitish Nayar this data-hiding concept is called encapsulation you can google it (as well as other OOP concepts)

  • @Xendra
    @Xendra 11 років тому

    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.

  • @jayhoss6433
    @jayhoss6433 9 років тому +4

    So what happened to Kelsey?

  • @MafSamaaa
    @MafSamaaa 8 років тому

    I had a hard time learning this until I got to your page:D

  • @duykhuong5634
    @duykhuong5634 8 років тому +16

    Too complicated to understand! I've watched it by far for at least 7 times. Nice video, though.

    • @Jatlu1337
      @Jatlu1337 8 років тому +2

      Try it out for yourself a few times, it will help!

    • @dnangel4277
      @dnangel4277 6 років тому +2

      Don't just watch the video, but try different variations of his code and try to understand what you did :)

    • @hammadmansoor5209
      @hammadmansoor5209 5 років тому

      Just follow along with tutorials as long as they don't give an error. You will understand in next couple of videos.

    • @hetaeramancer
      @hetaeramancer 3 роки тому

      just copy the code to your compiler and try changing it over and over again according to your liking. easy as fuck

  • @Xendra
    @Xendra 11 років тому

    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.

  • @Spikeruleshell
    @Spikeruleshell 11 років тому +11

    "She was a babe."
    Lol

  • @ccsphere
    @ccsphere 11 років тому

    I'm glad your voice is clear and loud, and you're good at explaining :D

  • @lorebone9772
    @lorebone9772 8 років тому +6

    Is Pillow could be a Girl name?

  • @SirFency
    @SirFency 5 років тому +1

    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.

  • @willhand253
    @willhand253 10 років тому +3

    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 ();
    }
    }

  • @spy85able
    @spy85able 11 років тому +1

    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!

  • @aikslf
    @aikslf 10 років тому +65

    I understood all of your Java Beginner tutorials from part 1 to part 16 but I don't understand any of this.

    • @gallegom58
      @gallegom58 10 років тому +22

      I thought I was the only one! This lesson just escalated quickly

    • @hen665
      @hen665 10 років тому +15

      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.

    • @gallegom58
      @gallegom58 10 років тому +7

      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

    • @aikslf
      @aikslf 10 років тому +2

      Michael Gallego Thanks for the suggestion. I have decided to finish learning web languages first before resuming my Java lessons

    • @Gorky25
      @Gorky25 10 років тому +2

      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....

  • @kamala89
    @kamala89 12 років тому

    I watched this 4 times in a row, and now I understand "little bits of it" :D

  • @aucksy
    @aucksy 9 років тому +4

    thenewboston this one is really confusing...

  • @MrPeoplestv
    @MrPeoplestv 8 років тому

    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.
    "

  • @tyren818
    @tyren818 10 років тому +8

    I lost you on this tutorial.

    • @motamendez
      @motamendez 10 років тому

      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
      .

    • @corycline7804
      @corycline7804 10 років тому +4

      Emilio Mota Does it Really say "Read slow for avoid confuse" literally?

  • @TheOneServant
    @TheOneServant 11 років тому

    This is great as it teaches good data encapsulation from the beginners level.

  • @ParadoxTiger
    @ParadoxTiger 11 років тому +5

    Why not just do this:
    public void saying(){
    System.out.println("Your first gf was " + getName());
    }
    I tested it... It works the same.

    • @dumbasffff
      @dumbasffff 11 років тому +2

      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...

    • @WattoTheGamer
      @WattoTheGamer 11 років тому +2

      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());

    • @dumbasffff
      @dumbasffff 11 років тому

      There are many ways to solve a problem. What's your point?

    • @K20eighty3
      @K20eighty3 11 років тому

      Thanks for pointing out the obvious. If you look at the title, Bucky is giving an EXAMPLE of using many methods and instances.

  • @mennamahmoud570
    @mennamahmoud570 2 роки тому +2

    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

    • @robertwest3361
      @robertwest3361 2 роки тому +1

      Thank You!

    • @minecraftkid50978
      @minecraftkid50978 Рік тому

      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!

  • @Sinehmatic
    @Sinehmatic 9 років тому +3

    Is it just me or there is a lot of redundancy in this code that is probably more suitable for more complicated applications?

    • @iamsholls138
      @iamsholls138 9 років тому +6

      +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
      @Sinehmatic 9 років тому +4

      i amsholls Yeah I understand that, I was just wondering if what I said was _also_ true

    • @andyz6994
      @andyz6994 8 років тому

      +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

    • @smittenessmee
      @smittenessmee 8 років тому +1

      +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)

  • @anoniem9448
    @anoniem9448 9 років тому

    My god man you are the best at explaining. Evrything is so clear!

  • @juliuspetersson179
    @juliuspetersson179 10 років тому +5

    fuckin hell ive lost track of absolutely everything now, what the fuck is going on here!?

    • @rbflowin_TV
      @rbflowin_TV 10 років тому +2

      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.

  • @mafiaundrground
    @mafiaundrground 7 років тому

    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

  • @georgecernat6166
    @georgecernat6166 8 років тому +10

    Schtring

  • @vertaz47
    @vertaz47 12 років тому

    @ 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

  • @theblasphemousgospel6824
    @theblasphemousgospel6824 9 років тому +8

    But I never had a proper girl friend:(

    • @WiggumRalph
      @WiggumRalph 9 років тому +3

      Robert Haxor lol same, I put down. Forever alone lol

    • @theblasphemousgospel6824
      @theblasphemousgospel6824 9 років тому

      Proud to be Irish Forever along :(

    • @WiggumRalph
      @WiggumRalph 9 років тому

      Robert Haxor lol

    • @theblasphemousgospel6824
      @theblasphemousgospel6824 9 років тому

      Proud to be Irish What is it like to be Irish?

    • @WiggumRalph
      @WiggumRalph 9 років тому

      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)

  • @Toopa88
    @Toopa88 7 років тому

    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());

  • @ichevtchenko
    @ichevtchenko 10 років тому +5

    What do I write if I never had a girlfriend ._.

    • @aikslf
      @aikslf 10 років тому +3

      Write best friend instead

    • @jarjar561
      @jarjar561 10 років тому

      kooskotopia What if I've never had a friend before?

    • @aikslf
      @aikslf 10 років тому

      DarkYogurt Worst enemy/ Most hated person

    • @Golinth
      @Golinth 10 років тому

      kooskotopia What if I don't have one of those?

  • @danielgaytan7569
    @danielgaytan7569 9 років тому

    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 :)

  • @breakdancerQ
    @breakdancerQ 8 років тому +14

    What if I don't have a girlfriend? I can't fill in anything.

    • @Kreater91
      @Kreater91 8 років тому +12

      Feelsbadman

    • @Steady_OG
      @Steady_OG 8 років тому

      yeah bucky! what if we dont have a gf

    • @breakdancerQ
      @breakdancerQ 8 років тому

      Did that work?

  • @petervaneert
    @petervaneert 12 років тому

    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

  • @ΣωτήρηςΛεβέντης
    @ΣωτήρηςΛεβέντης 8 років тому +3

    my girlfriend is in the room so i change girlName to sportName to not make her angry

  • @ayeshamarwaha6718
    @ayeshamarwaha6718 10 років тому

    you're the best bucky! also, the humor totally helps. thank you for these epic tutorials. cheers.

  • @00shrimp
    @00shrimp 10 років тому +5

    she was a babe ^ _^

  • @coreyisit1048
    @coreyisit1048 9 років тому +2

    Thank you bucky. Your videos are very helpful. I have learned a lot from you

  • @iyadajeeb1986
    @iyadajeeb1986 9 років тому +3

    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 !

    • @sahraouisidahmed4250
      @sahraouisidahmed4250 9 років тому +1

      ***** 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

    • @iyadajeeb1986
      @iyadajeeb1986 9 років тому

      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 !

    • @sahraouisidahmed4250
      @sahraouisidahmed4250 9 років тому +1

      ***** 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

    • @aucksy
      @aucksy 9 років тому

      ***** I feel the same... its so complicated...

    • @za3zoo31
      @za3zoo31 9 років тому

      +Aashray Tattva Das I found it easier after some more practicing on the previous tutorials

  • @yesidmartins3918
    @yesidmartins3918 5 років тому

    the sound is horrible but the best java classes I've seen so far on youtube. thanks

  • @arveersingh9728
    @arveersingh9728 8 років тому +9

    am i the only one who finds this tutorial a bit confusing and tough(ugh! i feel dumb)

  • @superstarben37
    @superstarben37 12 років тому

    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.

  • @Thaulopi
    @Thaulopi 11 років тому +1

    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!

  • @mabroorahmad2182
    @mabroorahmad2182 4 роки тому

    Thank you bucky for teaching hope to see you in the next video

  • @JamesWorsfold
    @JamesWorsfold 12 років тому

    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.

  • @JamesSuperiorHD
    @JamesSuperiorHD 11 років тому

    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!

  • @dopier12
    @dopier12 7 років тому

    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.

  • @hudali311
    @hudali311 12 років тому

    where were you when I was an undergrad student struggling with java back in 2007 :"(
    ure the best I swear

  • @LetumFilms
    @LetumFilms 11 років тому

    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

  • @sanjayKumar-sl6ho
    @sanjayKumar-sl6ho 6 років тому +1

    10 years , still useful

  • @MrStefan1221
    @MrStefan1221 7 років тому

    Thanks man, I was doing terrible in programming class but you helped me understand everything a lot better!

  • @johnnycook7500
    @johnnycook7500 11 років тому

    @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.

  • @gniw1584
    @gniw1584 6 років тому

    Watching this at New Year 2019, still very helpful! Thanks!

  • @lolhiitstombye
    @lolhiitstombye 11 років тому

    Had to watch this a few times to understand, but dw guys, don't give up, you'll get it in the end :p

  • @naxpad
    @naxpad 10 років тому

    Thanks again abit confusing but able to figured it out by the comments I wrote down. Really like your tutorial barky. Great thanks!!

    • @seanslik1
      @seanslik1 10 років тому +2

      Bucky not Barky... U is far from A on most keyboards so i know that wasn't a typo.. everyone knows it's Bucky

  • @ojasthakurx
    @ojasthakurx 10 років тому

    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

  • @sonic2kk
    @sonic2kk 11 років тому

    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

  • @Xendra
    @Xendra 11 років тому

    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.