Difference between String s="hello"; and String s=new String("hello"); in Java

Difference between String s="hello"; and String s=new String("hello"); in Java.

The statement String s = “hello” is initialized to s and creates a single interned object. While String s = new String(“hello”); creates two string objects, one – interned object, two – object on the heap.
Java vs. Javascript
The differences of Java and Java Script are: - Java can stand on its own where as Java Script mandatorily be placed within an HTML document.....
Explain upcasting and downcasting in Java.
Upcasting: Java permits an object of a sub class can be referred by its super class. It is done automatically.....
Can you explain benefits of classpath?
Classpath is the path in which JVM searches for class libraries at the time of compiling the Java Application. By setting the CLASSPATH environment variable....
Post your comment