Joined May 2022
337 Photos and videos
A Roadmap to become JAVA backend developer. 🧵👇
10
49
138
Try this 🤔 Integer a = 100; Integer b = 100; System.out.println( a == b) // true Integer x = 200; Integer y = 200; // false you know why?! #Java #Programming 👇
1
43
The Tricky Part: == vs .equals() This is where == gets tricky! == checks if two references point to the exact same object. For numbers in the pool, they often do. Outside the pool, even if values are identical, they're separate objects. Always use .equals() for value comparison
1
36
In Action Integer num1 = 50; Integer num2 = 50; System.out.println(num1 == num2); // true (pooled!) Integer num3 = 150; Integer num4 = 150; System.out.println(num3 == num4); // false (not pooled!)
28
Ever wonder why "hello" == "hello" is true, but new String("hello") == new String("hello") is false? Let's unravel this 👇 The String Pool
1
41
Classic Gotcha: `==` vs `.equals()` Comparing user input (often dynamically created Strings) with constant literals using == will likely fail! ❌ Always use .equals() for content comparison. Remember: == for reference, .equals() for value.
1
35
Key Takeaways: Java's String Pool reuses literals. new String() always creates new objects. intern() forces pooling. == vs .equals() is crucial for comparison
31
Q: How do you share variable in thread life cycle? A: Java ThreadLocal class allows the storage of data that is specific to each thread separately. It is often used to implement thread-specific context or to avoid synchronisation for thread-local data
4
1,087
What do you think most difficult/complex topic in JAVA ?
7
1
21
3,731
6 Effective error handling in Java: Discover the best practices and strategies to ensure smooth sailing in our Java applications! 🚀🔍
2
2
7
1,327
Handle Resource Cleanup with try-with-resources: Use try-with-resources when dealing with resources like as files or database connections to guarantee that resources are automatically closed at the conclusion of the block, limiting the possibility of resource leaks.
1
255
That's a wrap; I hope you find this thread helpful Share your Java coding best practises and experiences. Let's create a developer community devoted to writing code that's fun to work with! 🤝📷🚀 Thanks for reading. - RT/Like below tweet x.com/java_experts/status/16…

6 Effective error handling in Java: Discover the best practices and strategies to ensure smooth sailing in our Java applications! 🚀🔍
210