<

I just announced the new Spring 5 modules in REST With Spring:

>> CHECK OUT THE COURSE

This tutorial series focuses on core Java – “Back to Basics”. We’re going to cover Java Collections and Java IO:

1. Core Java Language Concepts

>> Java – Try with Resources

>> Guide to the Synchronized Keyword in Java

>> A Guide to Java 9 Modularity

>> Class Loaders in Java

>> Using Java Assertions

>> Inheritance and Composition (Is-a vs Has-a relationship) in Java

>> Guide to the Volatile Keyword in Java

>> Wrapper Classes in Java

>> Quick Guide to java.lang.System

2. Core Java

>> Java 8 – Powerful Comparison with Lambdas

>> Java – Random Long, Float, Integer and Double

>> Java Timer

>> Java Scanner

>> Java – Round Decimal Numbers

>> Java – Guide to UUID

>> Java – Changing the Order in a Sum Operation Can Produce Different Results?

>> Java – Comparing getPath(), getAbsolutePath(), and getCanonicalPath() in Java

>> Java – ClassNotFoundException vs NoClassDefFoundError

>> Java – Iterating over Enum Values

>> Java – The StackOverflowError

>> Java – Double Brace Initialization

>> Java – Introduction to JDBC

>> Java – Converting a Stack Trace to a String in Java

>> Java – Period and Duration in Java

>> All about Strings in Java

>> Java – Make a Deep Copy of an Object

>> Java – Externalizable Interface

>> Java – Measure Elapsed Time

>> Java – Internationalization and Localization

3. Java Concurrency

4. Java Collections

5. Java Streams

6. Java IO

7. Advanced Java

>> Working with Network Interfaces in Java

>> Convert Hex to ASCII in Java

>> How to Print Screen in Java

>> A Guide To UDP In Java

>> How to Get a Name of a Method Being Executed

>> How to Find all Getters Returning Null

>> Changing Annotation Parameters At Runtime

>> How to get all Dates Between Two Dates?

>> Guide to Escaping Characters in Java RegExps

>> Introduction to Java Serialization

>> Call Methods at Runtime Using Java Reflection

>> Dynamic Proxies in Java

>> Using Java MappedByteBuffer

>> LongAdder and LongAccumulator in Java

>> Guide to sun.misc.Unsafe

>> Guide to Java Clock Class

>> Java 8 Math New Methods

>> Guide to ResourceBundle

>> ASCII Art in Java

>> Java – Service Provider Interface

>> Sending Emails

>> Double Checked Locking with Singleton

>> Java – Introduction to SSL

>> Java KeyStore API

>> Introduction to JavaFX

8. Tracking Java Development

>> Java 8 – News

>> Java 9 – News

>> Best Java Blogs

There we go – the “Back to Basics” Java series, covering basic operations with collections and IO.

I just announced the new Spring 5 modules in REST With Spring:

>> CHECK OUT THE LESSONS

  Subscribe  
newest oldest most voted
Notify of
Deepak Pandey
Guest
Deepak Pandey

Hey Eugen. when we use new operator to create a String object.
i.e String obj1=new String(“abc”);
It will create object in heap , but is it create an object in String pool also or copy the value in string pool.
Please elaborate the process.
Thanks
Deepak

Eugen Paraschiv
Guest

Hey Deepak. Simply put, when you instantiate the String object via the constructor, you’re creating a new object on the heap. When you’re using the String literal, you’re referencing it in the String pool. That distinction will determine the equality of these references.
Of course there are a lot of solid tutorials online that go into the details of how that works, so I’d definitely recommend doing a search and reading through some of these – it’s worth taking a bit of time to get the basics nailed down.
Hope it helps. Cheers,
Eugen.

drumdumdum
Guest
drumdumdum

See Example 3.10.5-1. String Literals in Java language specification. Literal strings within the same class (§8) in the same package (§7) represent references to the same String object (§4.3.1). Literal strings within different classes in the same package represent references to the same String object. Literal strings within different classes in different packages likewise represent references to the same String object. Strings computed by constant expressions (§15.28) are computed at compile time and then treated as if they were literals. Strings computed by concatenation at run time are newly created and therefore distinct. The result of explicitly interning a computed… Read more »