Java Constructor Chaining - 034

Поделиться
HTML-код
  • Опубликовано: 7 ноя 2024

Комментарии • 14

  • @sankalparora9374
    @sankalparora9374 3 года назад +1

    Amazing explanation

  • @Zotijdvooreenpauze
    @Zotijdvooreenpauze 7 лет назад +3

    Great tutorial, love the graphics!

  • @joelvilleneuve7037
    @joelvilleneuve7037 5 лет назад

    exactly what i needed ty

  • @bennyburwell3102
    @bennyburwell3102 7 лет назад +17

    I'm super gay and hate football but it was still an amazing explanation, thanks.

    • @AlfeYT
      @AlfeYT 3 года назад

      You made my day mate 😂

  • @h0rban
    @h0rban 6 лет назад

    Will the code compile if you are not referring to this.hometeam in your second constructor because they have the same name ?

  • @lokeshloki8795
    @lokeshloki8795 5 лет назад

    Why we use constructor chaining in java

  • @piotrkaminski2445
    @piotrkaminski2445 6 лет назад

    Good explanation! :)

  • @maazahmedpoke
    @maazahmedpoke 6 лет назад

    what if the constructor doesn't take any argument?

  • @insmallportions
    @insmallportions 2 года назад

    Very good explanation but the example could have been better. The specific chains chosen make it hard to understand the concept. Why would a constructor that takes a year assume the team names? Something like "Home Team", "Away Team" would make it more clear what is going on, and would prevent the internal monologue of "it is just an example" that detracts from an otherwise great explanation.

  • @zedjurk
    @zedjurk 5 лет назад +1

    I like your explanation. But to my opinion you make a mistake in your example. See 3:24. You have to use the default values twice. And in the all-args constructor you first call the default and set the values to the default and directly pass the arguments. That does not make sense. I think this should be the correct way - default calls one-args which in turn calls all-args constructor
    public FootballGame() {
    this(2011)
    }
    public FootballGame(int year) {
    this(year, "Arizona", "Denver")
    }
    public FootballGame(int year, String homeTeam, String awayTeam) {
    this.year = year;
    this.homeTeam = homeTeam;
    this.awayTeam = awayTeam;
    }

  • @nurbayarahim5915
    @nurbayarahim5915 8 лет назад +1

    ha

  • @vinayTshetty
    @vinayTshetty 8 лет назад +1

    nice post more videos

  • @DanielADickey
    @DanielADickey 6 лет назад +3

    String comment = "I'm more confused about constructor chaining than ever before, thanks for nothing!";