Difference between creating a java string with same values using a “new” keyword and a string literal as below:
String myStr1 = new String(“Mulligan”);
String myStr2 = new String(“Mulligan”);
AND
String myStr1 = “Seagan”;
String myStr2 = “Seagan”;

Which java package has the String class?
java.lang.String
Explain sub String operations with examples.

As strings are immutable, explain a situation where they can cause memory leaks?
In the example below, as a is now pointing to a new string, the unreferenced heap are will cause a memory leak.

What are StringBuilder and StringBuffer in Java?

Difference between pass by value and pass by the object?
What is encapsulation in Java?

What is the default access modifier in Java?
When an access modifier is not specified in a class, the default access is available within the declaring class and the classes in the same package.
What are the different access modifiers in Java?

What is inheritance in Java?

How many classes can be inherited by a class in Java?
Each class in java can only extend one class.

Can we inherit the constructor of the parent class?
No. Every class should have its own constructor. It cannot inherit a constructor from the parent.
What is a chaining constructor?

What happens when we do not explicitly use a super() in the child class?
Remember when the parent class does not have a default constructor the child class will give a compilation error when super() is not used.

Where is the super called?
Because a parent should exist before the creation of a child.

What is overriding in Java?

Can we override private and static methods?

How do we call the parent’s method after we have overridden the method in the child class?

What is a covariant return for overriding methods?
??
How is the ‘final’ keyword used in Java?

What does adding ‘final’ in front of a method do?

What does ‘final’ in front of a class?

Where else in Java do we can observe ‘final’ usage?
