Jacqueline Brown wrote:String a = new String ("a") String a="a" ( a == a is false).
That's not true! This code will give you a compiler error (duplicate local variable a) But indeed, this code will print false:
Jacqueline Brown wrote:However, String literals are confusing me .Not sure if I am understanding how Java handles them correctly.
You should definitely read this excellent article about Strings. It has a great explanation about strings, string literals, string constant/literal pool and their equality (both using equals() method and == operator). I even think you'll be able to answer your own question after you have read (and fully understood) this article.
So read the article and then try to answer your own question. If you still don't have a clue or it's not 100% correct, I'll definitely answer your question and clear your doubts.