Strings are Immutable in Java

Поділитися
Вставка
  • Опубліковано 7 січ 2025

КОМЕНТАРІ •

  • @devendrasinghmeena7407
    @devendrasinghmeena7407 4 роки тому +5

    Happy to see you again!

  • @Ceyhus
    @Ceyhus 4 роки тому +9

    Awesome!!! Finally, someone explained simply what Garbage really is ))) Thank you

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

    *Informative content* 👍👍

  • @lamaspacos
    @lamaspacos 6 місяців тому +1

    03:17 We want use «new» for different String variables that point different strings with the same text.

  • @buddingscientist170
    @buddingscientist170 4 роки тому +5

    Welcome back neso academy

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

    Enlightening!
    Thank you for such an easy to follow explanation.

  • @telegramvideos1313
    @telegramvideos1313 3 роки тому +2

    BEST COURSE EVER!!!

  • @DeepakKumar-dw1re
    @DeepakKumar-dw1re 3 роки тому +2

    Btw your explanation is too good.
    Thanks for giving such an adorble content.

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

    thank you for this resource you created, its self explanatory.

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

    Thank you for clarifying this.
    I guess I misunderstood you on the last couple of videos and rush to conclusions. My bad.

  • @jorgeflores7278
    @jorgeflores7278 3 роки тому +1

    great explanation!

  • @dipeshsamrawat7957
    @dipeshsamrawat7957 2 роки тому

    I love you Neso Academy. ❤️

  • @JunaidKhan-ri5ev
    @JunaidKhan-ri5ev 5 років тому +2

    Quite helpful 🙂

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

    awesome expainition

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

    Welcome back❤️❤️❤️

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

    Love you🤭 thank you 💛

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

    Please upload java videos everyday.

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

    thank you bro

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

    Welcome back

  • @ma8969
    @ma8969 2 роки тому

    thanks

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

    Sir please make a playlist on servlet and jsp

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

    Thankyou sir 😊

  • @kenjohnsiosan9707
    @kenjohnsiosan9707 2 роки тому

    thank you sir

  • @MajesticQT
    @MajesticQT 2 роки тому

    Thanks!

  • @balakrishnaprasad8928
    @balakrishnaprasad8928 5 років тому +2

    Sir App release date??

  • @user-zq2pe3gw3f
    @user-zq2pe3gw3f 5 років тому +2

    Strings are immutable its value cannot changed but how it changed when we concatenate it with other string pls explain with reference address box

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

      Ya same doubt 🤔 please answer it !!!

    • @ManiKandan-vo2qr
      @ManiKandan-vo2qr 4 роки тому

      @@adityaghadge3957 : A separate object will be created in the string constant pool whose reference is pointed to it . But u can see the old value remains the same in the memory . It means it is not over ridden. So since that value is not overridden it is immutable .

    • @waxylayer8353
      @waxylayer8353 3 роки тому +2

      When S1 = "hello" , in the string pool a value hello would be created and S1 will point to it.
      When S1.concat("world") is done and when you print S1 you would get the output as hello only and not as helloworld, when u do S1 = S1.concat("world"); and print S1, now you will get the output as helloworld because the value helloworld would be newly created in the string pool and S1 would point to that and not hello value anymore due to the equal sign (=).
      But even when you modify it like this .. the hello is not editted it's in the same place or memory . We just created a new value in new place or memory .. and pointed S1 to it.
      So the hello would be removed by Garbage collector automatically if it's not been used.
      This Garbage collection is done by jvm itself

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

      @@ManiKandan-vo2qr that seems inefficient memory-wise. can we erase that old value from memory?

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

      @@hetaeramancer GC will automatically does that work

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

    wallah habibi come to dubai

  • @bahram-848durani2
    @bahram-848durani2 2 роки тому

    Great!!!

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

    you said strings can be collected by GC but its not the case when i searched on internet it says jvm does not allow GC to run in strings pool , can yo elaborate on this?

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

    100th like 😄🥳💥

  • @user-zq2pe3gw3f
    @user-zq2pe3gw3f 5 років тому

    Str1='val';
    Str='val2';
    What happened when same name of string object have different value explain with reference diagram(like 3.58 th minute in this video)

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

      Strings are immutable in java. So, you can not hold different values on the same name of the string.

  • @AbhishekKumar-ll4rr
    @AbhishekKumar-ll4rr 4 роки тому +1

    GC is not applicable for string constant pool

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

    Hey sir, String and constant are similar right, they cannot be change

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

    It's clear , and how about prinitives data type ? Are Java primitives immutable?

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

      no, if you assign a new value to an integer, the previous value will be overwritten and you will store the new value in the integer

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

    String bhot easy h

  • @Darshang.v
    @Darshang.v 2 місяці тому +1

    Who are seeing in 2024

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

    I think old value is not removed by Java Garbage Collector in the String Literal.

  • @ShahNawaz-cx3pi
    @ShahNawaz-cx3pi 5 років тому

    Data structures in C????

  • @rajnandanipuri2895
    @rajnandanipuri2895 6 місяців тому

    Alrrrrrrrright😂👍🏻

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

    String is stored in String Constant Pool and java garbage collector can not remove the value stored in String Constant Pool

  • @AbhishekVerma-gm8hr
    @AbhishekVerma-gm8hr 3 роки тому +2

    russian teacher h kya

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

    JAVA Garbage collector 🤣🤣🤣😅 Is that a real thing?