Core Java Bullet points………

map ,collection, generic, multithreding, exception

Sanjay Singh
4 min readNov 28, 2019

What is the difference between path and classpath variables?

The path is an environment variable which is used by operating systems

Classpath is very specific to Java and used for locating .class files by java executables

What is the final Keyword in Java?

Answer: Final keyword is used with the class to make sure that any other class can’t extend it. For example String class is final and we can‘t extend it

What is the volatile keyword in Java?

Answer: Volatile keyword in Java is used with variables and all the threads read its value directly from the memory location and don’t cache it. Volatile keyword makes sure that the read value is exactly the same as in the memory location.

What happens when an exception is thrown by the main method?

Answer: When the main0 method throws out an exception then the Java Runtime Environment terminates the program and the print the exception message which was stacked in system console.

IS-A relationship based on Inheritance, which can be of two types Class Inheritance or Interface Inheritance.

Has-a relationship is composition relationship which is a productive way of code reuse.

Difference between Constructor and Method

The purpose of constructor is to initialize the object of a class while the purpose of a method is to perform a task by executing java code.

Constructors cannot be abstract, final, static and synchronised while methods can be.

Constructors do not have return types while methods do

Main method declaration in Java

public static void main(String[] args)
you can use modifier final ,synchronized ,strictfp

public final synchronized strictfp static void main(String args[])

Main method overloading

Difference b/w Hashset, LinkedHashSet and TreeSet

Wildcards in Java

The question mark (?) is known as the wildcard in generic programming .It represents an unknown type. The wildcard can be used in a variety of situations such as the type of a parameter, field, or local variable; sometimes as a return type

Types of wildcards in Java:

Upper Bounded Wildcards: These wildcards can be used when you want to relax the restrictions on a variable. For example, say you want to write a

public static void add(List<? extends Number> list)

Lower Bounded Wildcards: It is expressed using the wildcard character (‘?’), followed by the super keyword, followed by its lower bound: <? super

Collection type <? super A>

Multithreding

Solid principal

--

--

Sanjay Singh

Java||Spring-Boot|| Micro services Application developer|| INDIA