What is the purpose of a default constructor?

The purpose of the default constructor is to assign the default value to the objects. The java compiler creates a default constructor implicitly if there is no constructor in the class. Output: Explanation: In the above class, you are not creating any constructor, so compiler provides you a default constructor. Here 0 and null values are… Continue reading What is the purpose of a default constructor?

How many types of constructors are used in Java?

Based on the parameters passed in the constructors, there are two types of constructors in Java. Default Constructor: default constructor is the one which does not accept any value. The default constructor is mainly used to initialize the instance variable with the default values. It can also be used for performing some useful task on object… Continue reading How many types of constructors are used in Java?

What is the difference b/w an object-oriented programming lang.. and object-based programming lang..?

There are the following basic differences between the object-oriented language and object-based language. Object-oriented languages follow all the concepts of OOPs whereas, the object-based language doesn’t follow all the concepts of OOPs like inheritance and polymorphism. Object-oriented languages do not have the inbuilt objects whereas Object-based languages have the inbuilt objects, for example, JavaScript has… Continue reading What is the difference b/w an object-oriented programming lang.. and object-based programming lang..?