Java interviews test core language understanding first, then collections and concurrency, and for most backend roles, Spring Boot and microservices. These are the questions asked most often, with answers short enough to say in an interview.
The JVM runs Java bytecode. The JRE is the JVM plus the standard libraries needed to run programs. The JDK is the JRE plus development tools such as the compiler (javac).
For security (strings are used for class names, paths and credentials), thread safety, and so the string pool can safely share instances. It also lets a string cache its hash code.
== compares references (whether two variables point to the same object). equals() compares logical content, as defined by the class.
If two objects are equal according to equals(), they must return the same hashCode(). Breaking this makes HashMap and HashSet behave incorrectly.
ArrayList is backed by an array: fast random access and usually the better default. LinkedList supports cheap insertion and removal at known positions but is slow for indexed access and uses more memory.
Keys are hashed to a bucket index. Collisions are stored in a list per bucket, which Java 8+ converts to a balanced tree when a bucket grows large. The table resizes when it passes its load factor (0.75 by default).
HashMap is not thread-safe. ConcurrentHashMap allows safe concurrent reads and writes using fine-grained locking and CAS operations, without locking the whole map.
It guarantees visibility: writes to the variable are immediately visible to other threads. It does not make compound operations such as count++ atomic.
Know Java 8 features well (lambdas, streams, Optional) and be aware of newer ones such as records and var.
For freshers, often yes. Experienced roles focus more on Spring Boot, design decisions and real production issues.