In other words, default constructors are the no argument constructors which will be created by default in case you no other constructor is defined by the user. Default Constructor: In Java, a default constructor is the one which does not take any inputs.Also, it has no return type and it is automatically called when an object is created. It must have the same name as that of the class. In Java, constructor refers to a block of code which is used to initialize an object. Refer to the below image which displays different primitive type, wrapper class and constructor argument. These are known as wrapper classes because they “wrap” the primitive data type into an object of that class. Every primitive data type has a class dedicated to it. Wrapper classes convert the Java primitives into the reference types (objects). Java is not 100% Object-oriented because it makes use of eight primitive data types such as boolean, byte, char, int, float, double, long, short which are not objects. Java is called platform independent because of its byte codes which can run on any system irrespective of its underlying operating system.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |