String object creation behind the scenes || string constant pool || java.lang.String

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

КОМЕНТАРІ • 36

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

    Best exaplaintion after watching 10 different videos. Great job man 👏

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

    Cool. Easy to learn java string and string constant pool

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

    Great teaching, concept is very clear,keep doing more

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

    Awesome.. Great teaching Sir 👏👏👏we understand the concept in ur teaching so soon..

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

    Avilash you are great teachers. I am watching all of your video's. The way you explain things direct goes into brain.

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

    Great

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

    Nice explanation bhaiya.you are doing a great job.your english is mind blowing.keep it up.

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

    Perfect practical explanation ! Keep on ...

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

    thanks for making me understand so precisely😊

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

    Super experience

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

    Super , Thankyou

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

    bro can u please do vedeos on java8 features full tutorial mainly java8 streams

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

    super

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

    When any string will be created with new key word like - new String("Java"), then the object will be created in Heap memory not in String Constant Pool.

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

    thanks man, and what happends when you make a System.out.println("var"); where is the "var" created? and what happen when I.E.
    String c="var";
    System.out.println("var"==c);
    why does it return false?

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

    @ 17:19 | S1 and S2 are not objects but just data types, Although good explanation.

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

      not data type it reference variable right?

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

    Nice

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

    Thank you abhilash I got the concept clear

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

    In case of String s= new String ("java")- since object is Stored in heap as well, then what role does java in String constant pool play?

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

      Scp is used to improve performance suppose we already have a string object with same content then it'll retrieve from scp quickly that's why creating strings with literals i.e String str="hello"; is preferred

  • @subbu5b0
    @subbu5b0 6 років тому +1

    How can you prove that 2 objects will get created (in heap & in Scotland) when we create a String object using new?

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

      -- You need to use intern() of String class.
      -- using intern() method with String object created using "new" keyword, will return the reference of the exact String object created in SCP area.
      public class TwoObjectsCreatedProof
      {
      public static void main(String[] args)
      {
      String s1= new String("Hello"); // 2 objects are created "Heap' and "SCP" area.
      String s2=s1.intern();
      // returns the reference from the SCP area and assigns it to 's2'.
      System.out.println(s2); // prints "Hello" from SCP area
      System.out.println(s1==s2); // false
      }
      }

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

    sen harikasın

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

    String s=new String("java"); here, "java" will not go into string constant pool unless we say intern

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

    can you please explain what is differ b/w final and immutable

  • @JohnWick-zc5li
    @JohnWick-zc5li 6 років тому

    if the String pool becomes full -- how JVM will delete or flash the strings from Constant Pooling

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

    How does the Intern method works if creating a string using new creates two objects one in the heap and one in scp. Isn't the whole purpose of intern is to create a copy in scp

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

    if i go for s1.equals(s2) in IF statement then it will gives the output of if statement..how..this possible..?

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

      Because equals method compare content in string class

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

    where is the scp area located in jvm ?

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

    please remove the background music its irritating and distracting

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

      Sure.. Will keep that in mind. Thanks for letting me know Parikshit.