1) What are Primitive and Non-Primitive Data Types? Answer: The below is the answer for this question: Data Types that are non-object oriented are know as Primitive Data Types. Examples for Primitive Data Type: byte,short,int,long,float,double,char and boolean Data Types that are object oriented are known as Non-Primitive Data Types. Examples for Non-Primitive Data Type: String,…
1) What are the differences between methods and constructors? Answer: The below is the answer for this question: When compared to Methods: 1. Constructors won’t have any return type 2. Constructors should have the same as the Class name 3. Constructors are automatically called when objects are created For detailed answer with practical examples and…
1) What is the difference between == and equals()? Answer: The below is the answer for this question: == operator compares the string objects, where as equals() function compares the text stored in the string objects. public class Demo{ public static void main(String[] args) { String a = new String("Hello" ); String b = new…