Strings in java explained
What are Strings?
String is a data type in Java which is a sequence of characters. In simple words we can understand this as an array of characters.
In Java we can implement string in two ways
By string literal
By new keyword
- By String literal ...
akashdevblog.hashnode.dev5 min read
When we use the (==) operator java compares the value of the variables basically it checks whether the variables are pointing to the same object or different.
No Akash the, Equal to (==) does not compare that variable is pointing to the same operator it just compares the value itself.
String firstString = "Bunny"; String secondString = "Bunny";Both the firstString and secondString have equal values of the address i.e. a Hexadecimal value, but saying they are pointing to the same object or different means also the same.