Difference in declaration of Strings with or without 'new' keyword in Java

preview_player
Показать описание
In this video lecture we will learn the difference between declaration of String with "new" keyword and without "new" keyword.

eg:
String s = "Hello";
String s = new String ("Hello");

We have discussed only the theory part here in which I have made some diagram or memory representation but If you want to see the java program then watch my video in which I have used methods to differentiate between them, the link of which is below.

video lecture : (part 2 of this video)

== vs equals() vs equalsIgnoreCase() vs compareTo() in Java
Рекомендации по теме
Комментарии
Автор

One more thing if we cannot used the new keyword then the garbage collector remove the unused objects

BgMi-dp
visit shbcf.ru