Interview Questions, Answers and Tutorials

11 Constructors & Enum

11 Constructors & Enum

11.1 | Constructors
 
Constructor declarations are similar to method declarations. However, the constructors’ names must be the same as the class name and it cannot return a value. The main objective of a constructor is to set the initial state of an object. When the object is created by using the new operator. The following code shows how to declare constructors with and without input parameters.
 
Constructor Class
 
 
11.2 | ENUM
 
Enum is a Java keyword used to represent a fixed number of well-known values. For example, the number of days in a week, the number of planets in the solar system, etc.
 
  
Example 11.2.1 Simple enum of weekdays.
 
Enum Class
 
Example 11.2.2 Simple enum of weekdays with weekday number
 
Enum Class
 
 
Example 11.2.3 An enum defining weekday full name and weekday number
 
Enum Class
 

39 thoughts on “11 Constructors & Enum

  1. Thanks for one marvellous posting! I enjoyed reading it; you are a great author. I will make sure to bookmark your blog and may come back someday. I want to encourage that you continue your great posts.
    Data Science Training in Chennai

    Data science training in bangalore

    online Data science training

    Data science training in pune

    Data science training in kalyan nagar

    Data science training in Bangalore

    Data science training in tambaram

    Data science training in kalyan nagar

  2. Your topic is very nice and helpful to us … Thank you for the information you wrote.

    Learn Hadoop Training from the Industry Experts we bridge the gap between the need of the industry. Bangalore Training Academy provide the Best Hadoop Training in Bangalore with 100% Placement Assistance. Book a Free Demo Today.
    Big Data Analytics Training in Bangalore
    Tableau Training in Bangalore
    Data Science Training in Bangalore
    Workday Training in Bangalore

  3. Really nice and interesting post. I was looking for this kind of information and enjoyed reading this one. Keep posting. Thanks for sharing.
    about us

  4. You should be a part of a contest for one of the highest quality sites on the net. I’m going to highly recommend this blog! The training and certification courses to get trained on microtek training. I got really cleared my doubts by reading your informative information.

  5. Really nice and interesting post. I was looking for this kind of information and enjoyed reading this one. Keep posting. Thanks for sharing.
    360DigiTMG

Comments are closed.