when i write
string s1="java";
in one program(application) and
string s2="java";
in another application
on the same jvm will both objects s2,s2 will refer to same
memory location where "java" is stored
in string pool.
Answers were Sorted based on User's Feedback
Answer / ss
String s1="java";
String s2="java";
System.out.println(s1.equals(s2)); -->true
System.out.println(s1==s2); --->true
| Is This Answer Correct ? | 6 Yes | 3 No |
Which collections are thread safe in java?
Why is the type for real numbers called double?
Can we iterate through collection using for loop?
How we can make copy of a java object?
If I will write String s=new String("XYZ"); String s1=new String("XYZ"); if(s.equals(s1)){ sop("True"); } else{ sop("False"); } This program will give me "True". But When I am creating my own class suppose class Employee{ public Employee(String name); } Employee e= new Employee("XYZ"); Employee e1 = neew Employee("XYZ"); if(e.equals(e1)){ sop("True"); } else{ sop("False"); } Then it will give the output as "False". Can I know what is happening internally?
Is a class subclass of itself?
What do you mean by Remote procedure call?
How are Observer and Observable used?
What is getkey () in java?
Explain the difference between map and flatmap stream operation?
What are the 7 types of characters?
class A { private int i; } class B extends A { private int i; } if I create an object of B class what will be the memory of that object.