Facebook – https://www.facebook.com/TheNewBoston-464114846956315/ GitHub – https://github.com/buckyroberts Google+ …

source

45 Comments

  1. Thank you for giving me class! I am a little confuse. Why it need "return" in toString method? I am confuse in this part, because I think the structure of this code is similar to the structure of time class (36-37). Thank you!

  2. Is there any difference between the System.out.printf("The constructor for this is %sn", this); compared to using
    System.out.printf("The constructor for this is %sn", toString()); ? They do the same since ''this'' calls the method toString() but I was curious if there are situations where you would rather call the method itself instead of using this to call it.. Hope I am making some sense T_T. Thanks in advance!

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

  4. I typed toString incorrectly. I typed it ToString.

    it wouldn't print the date, took me ages to figure it out.

    我好笨。

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

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

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

  8. So I tried replacing 'this' with toString() on System.out.printf("The constructo…..%sn", this);
    and I got the same result. So why exactly are we using 'this' ?

  9. Could someone explain why object's and constructor's "this" keyword refer to things from their class and not to things in the class they are being called in, please?

  10. Why are you using C language representation to print output. You should teach us the java representation of output.You are making the code a bit complicated and confusing beginners to learn.

  11. The improved constructor:
    public potpie(int d, int m, int y){
    day = ((d > 0 && d <= 31)? d : 1);
    month = ((m > 0 && m <= 12)? m : 1);
    year = y;

    System.out.printf("The constructor is %s", this);
    }

  12. I'm having a lot of trouble here with one part. When I type out:
    System.out.printf("The constructor for this is %sn," this);
    The compiler (Eclipse, latest version – 4.5.1) declares "Syntax error on token "this," delete this token. And of course without that token it still won't work. What's going on, and how do I fix this? :/

  13. 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("")

  14. im unfamiliar with the C language (the printf function) and dont really know how the "this" word works. so how is it that "this" references the toString method even though it wasn't called inside the main method?

  15. Thank you for showing me this great snippet of code 🙂 I'm going through all your tutorials although a ton of it I know I find that the way you describe things is very clear, precise and informational (meaning I always find something I didn't know on a topic I felt I knew most about).

  16. I have no Idea why this doesnt work:

    String.format("… my life %d/%d/%d", metai, menuo, diena); What Eclipse tells me is "rename"….. that's all

  17. I dont understand muricans, I mean, how the fuk mm/dd/yy is having more sense than dd/mm/yy, its like have sizes this way Medium, Small, Large, it doesnt have any sense does it ?

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

  19. When this tutorial is recorded, 2006 was 3 years ago. At this moment I am watching a tutorial who is old at least 6 years and the 2006 was 9 fucking years ago.

Leave A Reply

Please enter your comment!
Please enter your name here