Can you please help me how to create a class which is not inheritable and should be static in behavior (Means we should not be able to create instance of it). I need this class to store constant values. Thanks.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
you can use
finalkeyword to class can not be inherited.But I would recommend you to Use
Enums.Enumscan not be inherited and only one instance exists per constant value. Also you can do lot more withenums.You can read more about Enums here Enum Types