Java Fundamentals
Java Fundamentals
JVM is responsible for converting Byte code to the machine specific code
JRE is the implementation of JVM, it provides a platform to execute java programs. JRE
consists of JVM and java binaries and other classes to execute any program successfully
JDK Java Development Kit is the core component of Java Environment and provides all the
tools, executables and binaries required to compile, debug and execute a Java Program
JIT – Sometimes we heard this term and being it a part of JVM it confuses us. JIT is
part of JVM that optimizes byte code to machine specific language compilation by
compiling similar byte codes at the same time, hence reducing overall time taken for
the compilation of byte code to machine specific language.
Main method in all types of java classes interface, abstract, enum and normal class.
Normal Class can be created with only public, abstract, final and default access modifiers.
Arrays in java
Synchronization
If multiple threads access an ArrayList concurrently then we must externally synchronize
the block of code which modifies the list either structurally or simply modifies an element.
Structural modification means addition or deletion of element(s) from the list. Setting the
value of an existing element is not a structural modification.
a -> [1, 2, 4]
b -> [3]
c -> [5]
A good answer to this interview question is “because they are incompatible“. Collection has
a method add(Object o). Map can not have such method because it need key-value pair.
There are other reasons also such as Map supports keySet, valueSet etc. Collection classes
does not have such views.
Due to such big differences, Collection interface was not used in Map interface, and it was
build in separate hierarchy.
Junit - https://www.mkyong.com/tutorials/junit-tutorials/