init block in Kotlin

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

КОМЕНТАРІ • 20

  • @amitshekhar
    @amitshekhar  Рік тому +8

    Keep Learning, Keep Sharing, and Keep Growing.

  • @alankley
    @alankley Рік тому +4

    In the example code, I would recommend listing the secondary constructor (constructor()) BEFORE one of the Init blocks to emphasize that init blocks are called first. Otherwise one might think the secondary constructor is being called in the order it appears in the code (like the other init blocks)

  • @JahangirJadi
    @JahangirJadi Рік тому +1

    Your every videos are helping me getting better in Android. Please create more videos. I would love some videos on coroutines in android.

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

      Keep learning and keep growing. 👍

  • @ankiiiiit7866
    @ankiiiiit7866 Рік тому +1

    Superb, keep it up with more vedios like this.

  • @JamesChen-s6i
    @JamesChen-s6i 8 місяців тому +1

    Very good explanation.

    • @amitshekhar
      @amitshekhar  8 місяців тому

      Glad to see this comment 😇

  • @nvnkmr1290
    @nvnkmr1290 5 днів тому +1

    Helpful

  • @AmitVerma-iq3oe
    @AmitVerma-iq3oe Рік тому +1

    very well explained 👏

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

    Well explained, Only thing I don't understand is fullName property.

    • @amitshekhar
      @amitshekhar  Рік тому +2

      This is the explanation: A class can have more than one init block, in this case, the initializer blocks are executed in the same order as they appear in the class body considering the properties if there are any in between.

    • @rpitpatel1004
      @rpitpatel1004 Рік тому +1

      @@amitshekhar Thank you for explaining 🙏🏽

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

    Can you please upload basics of kotlin

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

      Thanks for the request. At present, I do not have any plan for it.

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

    But why property fullname called before 2nd init block and 2nd constructor?

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

      I have mentioned: A class can have more than one init block, in this case, the initializer blocks are executed in the same order as they appear in the class body "considering the properties if there are any in between".