This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have a class Notification, which has two constructors and set of Notification Object Parameters
There is a class called NotificationManager, which has a method addNotification which takes in param as a Notification Object. i.e. public void addNotification(Notification notification). Here the Notification object is created using the first Constructor. Then i do some file writing. Notification and Notification manager are in the same package
Then i have a class NavNotificationManager which extends NotificationManager and there is a method in this where i use the second Notification Constructor and store the Notification objects in a list. NavNotificationManager is in a different package.
The issue is that when i do addNotification and pass in the Notification object. I do the following:-
Notification localNotification = new Notification(-----params----);
This option shows that is can take value for both the Notification constructors. I dont want do pass in the values for the second contructor. I tried to made second contuctor private but that does not work.
It's hard to advise without understanding the problem.
And your problem is: There are two constructors, and you don't want to use the second constructor? Then my advice would be to not use it. You still have the first constructor. Of course you have said you know that and already use it in some cases, which means I don't understand your problem.