11 Constructors & Enum

11.1 | Constructors


Constructor declarations are similar to method declarations. However, constructors name 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









10 comments:

shalinipriya said...

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

Nila shri said...

Thank you a lot for providing individuals with a very spectacular possibility to read critical reviews from this site.
Devops training in Chennai

Devops training in Bangalore

Devops training in Pune

Devops training in Online

Devops training in Pune

Devops training in Bangalore

Devops training in tambaram

Devops training in Sollonganallur

Deops training in annanagar

Devops training in chennai

Deepika Analy said...

Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging

Cloud Training
Cloud Training in Chennai

amilu B said...

This blog is the general information for the feature. You got a good work for these blog.We have a developing our creative content of this mind.Thank you for this blog. This for very interesting and useful.
java training in chennai | java training in bangalore

java training in tambaram | java training in velachery

java training in omr

john jersy said...

This is quite educational arrange. It has famous breeding about what I rarity to vouch. Colossal proverb. This trumpet is a famous tone to nab to troths. Congratulations on a career well achieved. This arrange is synchronous s informative impolite festivity to pity. I appreciated what you ok extremely here.
python training in rajajinagar
Python training in btm
Python training in usa
Python training in marathahalli

gowsalya said...

Read all the information that i've given in above article. It'll give u the whole idea about it.
Devops training in sholinganallur
Devops training in velachery
Devops training in annanagar
Devops training in tambaram

SRI said...

Wow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your blog.

rpa interview questions and answers
automation anywhere interview questions and answers
blueprism interview questions and answers
uipath interview questions and answers
rpa training in chennai

Anonymous said...

It's interesting that many of the bloggers to helped clarify a few things for me as well as giving.Most of ideas can be nice content.The people to give them a good shake to get your point and across the command

angularjs Training in electronic-city

angularjs online Training

angularjs Training in marathahalli

angularjs interview questions and answers

angularjs Training in bangalore

angularjs Training in bangalore

Sadhana Rathore said...

These interview questions were helpful for beginners. Thanks for taking time to share this.
Data Science Training in Chennai
Big Data Analytics Courses in Chennai
Machine Learning Training in Chennai
Microsoft Azure Training in Chennai
DevOps Training in Chennai
AWS Training in Chennai
Data Science Training in Adyar

jefrin adams said...

Very impressive thanks for posting

Best DevOps Training Institute in Chennai