String Object String Literal Java
2,566 views · Published 8 February 2014 · 4:00 · Indexed 30 September 2026
Channel: Interview DOT · 2014 · Science & Technology
Click here - https://www.youtube.com/channel/UCd0U_xlQxdZynq09knDszXA?sub_confirmation=1 to get notifications. String Object String Literal Java
A Job Portal
http://www.InterviewDot.com http://www.InterviewDot.com http://www.InterviewDot.com
One Click Dream Job - http://www.interviewdot.com/upload-resume/uploadresume.htm
Are you looking for a new Job ?
InterviewDot.com - A Job Portal
http://www.InterviewDot.com http://www.InterviewDot.com http://www.InterviewDot.com
One Click Dream Job - http://www.interviewdot.com/upload-resume/uploadresume.htm
Difference between "String Literal" and "String Object" in Java ?
/STRING LITERAL
//-------------
//When you use a string literal the string can be "interned" but when you use new String
//you get a new string object.
//STRING OBJECTS
//--------------
//Here two different objects are created and they have different references:
//A String object is an individual instance of the java.lang.String class.
//In general you should use the string literal notation when possible.
//It is easier to read and it gives the compiler a chance to optimize your code.
//s1Str will refer to an interned String object. This means,
//that the character sequence "abcde" will be stored at a central place and whenever the same literal "abcde" is used again,
//the JVM will not create a new String object but use the reference of the 'cached' String.
//s2Str is guranteed to be a new String object,
String Object String Literal Java
More from this channel
-
3:19
java interview best books
-
5:51
Top 4 Job Interview Tips How to prepare for Job interview
-
5:29
Top Job Interview TIPS What are your strengths How to answer
-
2:42
what are different access modifiers core java interview questions and answers
-
2:24
What if the main method is declared as private core java interview questions and answers
-
0:32
Top 10 Job Career Websites in INDIA
-
2:08
Interview dos and donts how to prepare for interview
-
0:43
Top Core Java Interview questions and answers 8