Java Programming Tutorial - 42 - toString

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

КОМЕНТАРІ • 515

  • @saurabhk3464
    @saurabhk3464 6 років тому +82

    This guy is always high af lmao

  • @angiegarcia6354
    @angiegarcia6354 6 років тому +5

    I wish I had teachers like you at my university. You're engaging and humorous!

  • @OGZxBEEf
    @OGZxBEEf 13 років тому +29

    rofl "6 seems like a good year, long time ago" i laughed so hard i woke up my family

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

    I've advanced through his tutorials with no problems with his manner of naming things, I actually appreciate the sense of humor Bucky has, without it, the tutorials would probably be more tedious.
    Something I advice doing, is not naming your classes the same as Bucky, that way you avoid copying his code right as it is and actually have to change a thing or two, believe me, it's a much better practice.

  • @AJD...
    @AJD... 7 років тому +53

    "make sure you spell it wrong" 2:20
    lmao

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

    "uhh, let's put, the 'structor....make sure you sell it wrong.." haha, your commentary is awesome. These are my new favorite tuts, thanks for sharing your knowledge!

  • @stri8ted
    @stri8ted 13 років тому

    Thanks bucky. I like that you dont really spend spend time on theory, rather all application and how this stuff is actually used.

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

    Today I felt stupid because I couldn't understand some of the tutorials. But then I realized that those are 5-7 minutes tutorials. We just can't understand everything in a few minutes guys.
    We have to practice them or just accept it and move on. Bucky says in some of the tutorials "I hope you understand a little bit of this tutorial". He means that we should understand the basis, not everything.
    So keep learning and don't give up !!!

  • @elementoxygen
    @elementoxygen 14 років тому

    When you called it toString, there was a green little triangle that popped up. I clicked on it and some java stuff appeared, so now I know it is important to call the method toString. You are real smart in superb and computer programming.
    P.S. I think your awesome bucky

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

    I watched all the previous videos at 2x and now I switched to 1x and he now sounds high af. Loved that.

  • @rickvangils100
    @rickvangils100 13 років тому

    bucky, thank you so much!
    in your first like a 30 tutorials i didn't get many sense of each you did but how longer i follow your tutorials how more i going to understand what you are doing.
    you may should make my dream come true making money of creating games!
    bucky, you are a king!!!!!!!

  • @dtgonzalez1
    @dtgonzalez1 13 років тому

    Im so happy the more tutorials the more i understand i didnt even have to watch the whole tutorial cuz i already knew wat i had to do and i have no programming experience

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

    Shtring

    • @Kevin-iu4kj
      @Kevin-iu4kj 9 років тому +1

      +Daski69 shtfuckyou

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

      +Daski69 Why are you doing this to my brain?

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

      +Daski69 WHAT HAVE YOU DONE TO ME

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

      +alexlp2k10 MY LEARNING EXPERIENCE IS BROKEN SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING SHTRING

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

      市釧路 SHut the fuck up biatch

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

    I really love this guy's JAVA tutorials, keep up the good work!!

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

    That's the point of it. When you put "this" in the parameters, java doesn't know what variables to use, so the toString command is designed to be what "this" will use when it doesn't have any variables to use.

  • @Monsmak
    @Monsmak 14 років тому

    Apples, tuna, and potpie. No wonder I get so hungry when I am learning programing with Bucky, but it is so delicious. Thanks for tutorials, they are a real help!

  • @bfree456
    @bfree456 14 років тому +1

    @CTOhan You probably already figured this out, but it's because of the way toString() works. If you try to refer to an object as a string java has a built in toString() method that returns a string representation of the object. If you don't make your own toString() method it's just an address that doesn't make sense. Since he referred to the object in the constructor it just looked for the toString() method, which he wrote to return the date.

  • @irohproductions
    @irohproductions 13 років тому

    thank you so much!! you are a much better teacher than my actual teacher. its not really her fault, the administration just threw her in over her head and i have an assignment due and your video showed me how to do it. THANK YOU =) i am now a subscriber to you.

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

    One thing that might help the viewers understand this video is that if you don't define a toString method in your class, Java goes to the toString method of the Object class(parent class).

  • @DrBigJesus
    @DrBigJesus 12 років тому +19

    "6 seems like a good year" lolol

  • @abovestand
    @abovestand 14 років тому

    @haudace don't get confused lol, "toString" is just a common method used to return the instance variables of an object in string form

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

    A pot pie is a term for a type of baked savory pie with a bottom and top completely encased by flaky crusts and baked inside a pie tin to support its shape.
    The pot pie does differ from the Australian meat pie and many British regional variants on pie recipes, which may have a top of flaky pastry, but whose body is usually made from heavier, more mechanically stable shortcrust, hot water crust or similar pastries

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

    toString() is called anytime you want to get a string representation of an object.. it is built automatically, if you dont build one such method, so he overwrites (overrides) this method to return more appropriate format

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

    use print f where he does as printf stands for print formatted which you can order the information. i'm not very good with it myself but my understanding is that it is used to get it in the format you want, like %s stands for "insert string here" if you will, and then you place the string after the actual message to print and it fills the blank.

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

    %d acts as a place holder for a number. The first %d corresponds to the variable month, the second corresponds to the variable day, and the final %d corresponds to the variable year.

  • @CindySales333
    @CindySales333 13 років тому +1

    Thank you so much Bucky! You have been helping in through my java course all term. Go you! :)

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

    "6 seems like a good year, long time ago" first time I laughed watching these

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

    Wow! Hungry guy!
    From the first Java tutorial, you've mentioned:
    Apples
    Tuna
    Bass
    Pot pies

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

      Eames Van trinh He made two classes, one tuna, one bass. I forgot which episode it was.

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

      Eames Van trinh Want to follow me? I'll follow you.

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

      Eames Van trinh I followed you. Now follow me.

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

      Eames Van trinh Thanks.

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

      Eames Van trinh Wanna join plus.google.com/u/1/communities/117396812586339466106

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

    Strange that I just ate a potpie before I watched this...

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

    Your are helping me with your amazing videos

  • @relentless2917
    @relentless2917 7 років тому +1

    "Go ahead and percent... Go ahead and percent? Wtf does that mean?" Hahaha love your work bucky!

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

    Lmao make sure you spell contrtuctor wrong @ 2:21

  • @mcfundash1
    @mcfundash1 13 років тому

    I love these tutorials though it gets boring after a long time, but the funny comments after each vid keeps me motivated along with my hope of being able to make MC mods or even my own mini games/apps! Hopefully I'll learn C/C++ later from ur other tuts and maybe even Objective-C so I can make apps! :D

  • @midnightcarsintokyo
    @midnightcarsintokyo 13 років тому

    @syltman
    %s is the string variable, go to 5:40 and watch from there, he's stepping through the instructions and he tells you what it's doing at the %s part.

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

    Java is the beast and the beauty in the same time!

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

    It's been a long time my friend :) im teaching by a 10 years old video and it really helps me a lot.

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

    Love your tutorials! Don't worry about the haters below. I'm not seeing them doing any tutorials. Keep it up & thanks!

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

    I did some testing. If you change the name of the method toStirng, to something else, whatever, you will not have the same result. Instead it will give you the address of the object. So to achieve this effect, it is a must to use toString as method name.

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

    I don't like how "this" is so implicit, if that's the proper word. Why not do something like this:
    ... for this is %s
    ", dateFormatter());
    }
    public String dateFormatter(){
    return String.format(...
    That way if there are multiple toString methods, you won't have discrepancy over which to use...

  • @FreezySun
    @FreezySun 13 років тому

    You can initialize the variables like this too:
    private int month,day,year;
    ..which is even more comfortable.

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

    I had fun with this. I enhanced the date so days couldn't go over 31 and under 0, same with months except the limit was 12 of course. And in case of a negative year value, it would display "BC" without the minus sign.. the Math.abs() code was finally useful :D

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

    toString sets the format for the string. "this" called the "formatter", if you will, toString, which then structured the string output as defined in toString. "this" called potpie's toString because "this" only calls methods within it's own class

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

    You're way better than my ICS teacher

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

    So what I leaned from this is that the tostring is used when we use 'this' inside the constructor and the purpose of tostring is to substitute the string defined inside it in place of 'this'

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

      If you think I am wrong somewhere then please correct my understanding 😃😃

  • @Mattedatten
    @Mattedatten 14 років тому

    4:37 potpie whatEver = new potpie(9,22,2010)
    Heh, no, but, great tutorials! I'm wanted to work with Java game programming, and these are great "memory refreshers" and "more basics learners".
    Thanks!

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

    %s is for string, %d is for digits, and
    means to skip to a new line

  • @darkinin
    @darkinin 12 років тому +1

    Just think of "this" as being short for "thisClassObject" When you put this in the printf you're telling the function to use thisClassObject's toString method.

  • @bluesdave991
    @bluesdave991 15 років тому +1

    Good question - it's because of the to_String that he built. Whenever you tell Java to just print an object (like in System.out), Java will use the to_String function, which he built explicitly. When he wrote the code System.out.println(this), keep in mind that 'this' is an object. So that's what's being printed.

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

    %s is for string, %d is for numbers (decimal)

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

    It's printing out the code this means to use the int int the methos specifically cus there could be another int with the same name and the percent sighn means that it's asking for what string to print out every thing else is just regular words in quotes.

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

    how does java know 'toString' is the class for 'this'
    how does ti print that?
    is it random? feels like java is guessing most of my stuffs

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

      did you figure it out? and does 'this' in this case only respond to toString?

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

      RokasDesigns he tried to print an object using "System.out.printf". The object reference is "this" for the created object potpie. Whenever you try to print an object, java will automatically look for the method "toString". In this case, he overrides the method "toString" to let java know that this is what he want to come out when you try to print the object(potpie).

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

      ""this()" will invoke current class constructor.

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

      Yeah this can be confusing. But the 'this' keyword always refers to the current object. I don't believe how he used it here is the most common use case which adds to the confusion. When used here in place of a string it seems Java makes an assumption (a big one IMO, considering Java is pretty strict on being explicit anywhere else). Then he is "overriding" the 'toString' method. He doesn't say this but I believe it's important to mention to someone just learning the language. Hope this helps.

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

    How i understood it, the this statement in the print line because it has the %s
    that means it needs to use a string so it looks through the class for a string and it finds the toString so it uses it.

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

    Dude.... potpie.... This is unprecedented...

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

    does 'this' would look to a mathod called toInt or toDouble if I use '("%i %f",this, this);' instead ??

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

    7:15
    What if Der is more then one string method? Which method it will choose?🤔

  • @Babelfish112
    @Babelfish112 13 років тому

    AHAHA this was a funny episode! can't wait till the next epic adventure into the depths of toStrings! :)

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

    I don't understand one thing... at 1:25 Why do you use additional variables like month, day, year? Couldn't you use "return String.format("%d/%d/%d", m, d, y)" instead? ....to use the method's arguments directly? :/

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

      I believe the variables int m, d, y only work in the potpie constructor and not anywhere else. However, I could be wrong since I'm a noob at programming.

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

      GotterVibez Because Bucky is using object-oriented principles - as one should in Java - without explaining that he does and what these are. These are the dangers of teaching programming "as-is".
      The constructor is supposed to set the member variables with the values passed into the parameters. He actually explained this wrong a couple videos ago when he was first introducing "this".
      Just imagine the print-out would be somewhere outside of the constructor. You would use the member variables.
      The print-out should not happen inside the constructor. If it does, yes, you can use either the parameters or the actual member variables.

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

      Brax1982 Thanks, :) I was a newbie when I posted the question :) Now things are much clearer, but thank you for replying :D

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

      GotterVibez I figured you solved this by now. It's for readers, in general. =) That explanation a couple videos earlier was so wrong, it caused a ripple effect of confusion throughout the following videos.

  • @23scurtu
    @23scurtu 12 років тому

    HaHa everyones workin there way through all these episode like crazy to get to that gui episode :P
    I CANT WAIT

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

    "Should" and "have to" are two different things.
    While I and probably most other people name classes with capitalized nouns, I am sure that I've compiled classes with all lower case names to.

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

    What I don't get is why do we always return "strings" and not "ints" while we're dealing with numbers - such as 4,5,6. Is it because we hand write the numbers as arguments? Could someone explain me why?

  • @longdrivemama
    @longdrivemama 14 років тому

    OMG DUDE, THANKS A LOT, I was really confused on this stupid part, but thanks for clearing it up, only if I discovered this in the begining of the semester!!! :@

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

    40 second tutorial

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

    may I ask what font you used? Because I dont like the font im using right now

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

    so this time the "this" keyword calls the string method. In earlier tutorials, the "this" keyword called a constructor.
    Are there any other functions of this keyword as well?

  • @Bleyblader
    @Bleyblader 14 років тому

    thank you! it is great!! so clear and funny too :) Bucky do you have any tutorial on hashmap or treemap as well??

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

    Can you show us how to apply Scanner (in this or similar problem) in order to input the parameters form the keyboard.

  • @janeuarymmiv
    @janeuarymmiv 15 років тому

    i can used it when i start school\
    by November^.^
    keep it up

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

    When you entered the parameters for the public potpie method, why cant you just insert them str8 away as the previously initialized month, day, year variables?

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

    I think so, it relates to the objects for that class so there is no need for more than one toString method, that one method will be used by all the objects created for that class. I still don't have a clue what it does though...

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

    Want to be more efficient? After you have ur attributes n shit ready go to Right click - > Source - > generate Tostring(); You will find that you can also generate getters and setters for attributes there also and even constructors!

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

    Lmao, I had to spit out my coffee. This guy was not sober, but it was a good guide even if he was high as fuck!

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

    what a great explanation. thank you a lot

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

    when running the program, whenever it gets to the point in the program where the object is made, the code in the constructor is automatically run

  • @ikemefunaikemefuna
    @ikemefunaikemefuna 13 років тому

    this is the only way of getting the control out of the constructor for a while and after that it gets fully executed!

  • @tagpoth
    @tagpoth 13 років тому

    Hey guys, I have a question. In the 'Time Class' tutorial #36, when we created a method the syntax was
    public void setTime (int h, int m, int s){ }
    and in this tutorial for an another method the syntax was
    public potPie (int m, int d, int y){ }.
    So, my question is why we did not use void in here?

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

      probably waaaaaaaaaaaay too late but in case someone needs answer for this.
      public potPie (int m, int d, int y){ } is a constructor and constructor does not have return type that is why we don't put void or others in there. on the other hand, public void setTime (int h, int m, int s){ } is a method, and methods have a return type which in this case is void

  • @TheViolinCalamity
    @TheViolinCalamity 13 років тому

    @SPARTANRusty Yeah if you remember way back in tutorial 2 or 3 we made a project called bucky. Each class since then was right click on or in bucky, then new/ class. Hope that helps. I think they have to be in the same project to interact with each other, so tho we didn't see him make the new one that's where it must logically be.

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

    We can type syso then press CTRL+Space => System.out.println :)

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

    thenewboston somehow when i use printf and format it keeps putting that lightbulb x thing .What should i do?

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

    you rule in java ,you are the best :D

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

    Why do we use toString while we can directly print the output as system.out.printf("the constructor for this is %d/%d/%d", month, day, year)

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

      In your case the printf method will only reply to first parameter which is the month and the value 4. So you will see The constructor for this is 4.
      When you use ''this'' instead like in the video it overrided the constructor values with the parameters u initialized it with.
      So for example u make a 2nd String method that formats the values different way, for example:
      public String toRegular() {
      return String.format("%02d/%02d/%02d", month, day, year);
      }
      then your System.out.printf("The constructor for this is %s
      ", this); will refer to your toString() method, that is what the "this" basically does here.

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

      yes your method is also correct(like in C).but video just shows another method to do the same so it is like more solutions to same question. Here the main point of video is to explain that when we use "this" in that printf statement it is going to look for toString method (or function in C) by default

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

      no bro you are wrong the printf("%d/%d/%d",month,day,year); works absolutely fine . the point of the video is just to show the use toString. + im a C guy so i know printf works fine

    • @蔡敬勇
      @蔡敬勇 8 років тому

      thanks dude

  • @EvanHotwingsCorgiat
    @EvanHotwingsCorgiat 13 років тому

    apples, tuna... now potpie, what kind of food obsessions do you have Bucky?

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

    Are there other videos about this. Im having a hard time grasping this with his explanation.

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

      The %s means it NEEDS a string. That string is going to be 'this'. Whenever you use 'this' and require a String, java will automatically look for the reserved 'toString' method in the class and use it. In this case, 'this' refers to the constructor (as it is used inside the constructor), so the constructor object is converted to a string by the toString method. Well, at least I think...I'm only studying Java for 3 days!

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

      Tony Mazon thank u a lot , had a hard time understanding toString

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

    can variables in the constructor be the same name as the ones in the class?

  • @stri8ted
    @stri8ted 13 років тому

    @X3N4T3 Most probably not to confuse newbies.

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

    This was great, exactly what I was looking for. Still lost but less than 10 min ago :)

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

    Hey, isn't there a built-in method of the String class named toString()? Why isn't that covered here???

  • @srsankar333
    @srsankar333 14 років тому

    Where can i learn important methods and classes of java? I do not want to keep referring a book to find whether already existing methods and classes are already available for that function. I know C++ and know most of the functions by memory.

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

    so, in our "System.out.printf", as we used "this" and the "%s" so we know we were looking for a string, right? That is why we used the "toString" method (wich is a specific method from java). So if instead of a string we were looking for an int "%d" could we use a method called "toInt"?

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

      I do not believe so. You'd need to create the method toInt(), but then you can't ask for the object in integer form by just calling 'this', as toInt is not a special method, whereas toString is built into Java.
      To call the object as an integer, instead of typing 'this' you would type this.toInt(), which takes the object, and runs the method toInt, which returns an integer, to then be used by the %d parameter. Otherwise 'this' is interpreted as a strong and %d will get lost looking for an integer.
      Hope that makes sense.

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

      *****
      Thanks!! I got it

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

      Luís Nascimento He does explain that, but later on in the video he simplifies it so much that it sounds wrong again: The printf is calling the method "toString()", which is inherited from the Object class, on its parameter(s). Since he passes an object reference, the toString would not be a string that "makes sense" to humans. Therefore he is overriding (which the green triangle in Eclipse is telling you) the definition of toString with something reasonable. There is no "toInt()" Object method.

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

    @thenewbostan what if there are two methods which return the string

  • @EggnogEditz
    @EggnogEditz 13 років тому

    How do you write a to string method to output an array? Like for example given this:
    int[]marks 80, 59, 99, 21);

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

    Bonus tip:
    Instead of
    private int month;
    private int day;
    private int year;
    - you can just type
    private int month,day,year;
    I believe he said this a long time ago.

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

    can i use use more then one toSting in class ? how would i print for more than one constructor ??

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

    W00T! Can't wait!

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

    whats the point of creating int m,d,y when we can directly assign the value to day month and year?

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

    What if you just want to output /n or %s? Its really strange why you include those inside of the parenthesis in System.out.print("")

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

    what if i have multiple string printing in my code
    do i need multiple toString methods?

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

    I followed your instructions and it all works, but I was wondering why do we have to create private ints and then their correspondent ints later which are public? I have played around with the code and if I get rid of 'm,d,y' and make 'month, day, year' public it shows as 0/0/0 so obviously you cant cheat the code, but I dont really understand why.

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

    Hey Bucky, not sure what I am doing wrong here but am getting "The constructor for this is 0/0/0" when I run the program. Normally I get the same output as you, and if I don't I usually find the issue. This one has me stumped though! My classes do say package toString as my first line of code, something that I wasn't getting on windows 10, but recently switched to Linux Mint. Is that beginning line impacting my code, or am I overlooking something obvious? Thanks for being an excellent instructor!

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

      I figured it out! lol. My dum dum self did m=month d=day y=year, instead of month=m ect. Anyway about it though, thank you for uploading these great tutorials!

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

    Thx for sharing. I have a question. Why the method toString can be called automatically? Why not need to call it like Object.method() ? Thank you!

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

    I was following you up to the mid 30's I am so lost