A constructor program | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

A constructor program

DataMembers n:Integer MemberFunctions Special():Default Const.,To assign value 0 to n Special(int n):to assign avalue to n int fact(int n):returns factorial of a no. void sum():calculate the sum of 1st and last digit of n void isSpecial:check and display if n is a special no. or not

13th Sep 2016, 11:06 AM
Ansuman Mahapatro
Ansuman Mahapatro - avatar
2 Answers
0
Java Constructor Examples.Constructors are required to create objects for a class. Constructors are used to initialize the instance variables of an object. Constructor declaration looks like method declaration
13th Sep 2016, 12:53 PM
bryan
0
...
13th Sep 2016, 9:34 PM
Ali Al Garawy
Ali Al Garawy - avatar