shreyas Kulkarni

Greenhorn
+ Follow
since May 06, 2011
Merit badge: grant badges
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by shreyas Kulkarni

Can anyone please tell me what are the advantages of using Null object pattern? I tried to search too. I used it in my doubly linked list as first and last node(head and tail) but I am not able to figure out its use.
Thanks
If you implement any interface for your class like
class x implements yourInterface
then you have to write every abstract method you have in that interface. So you can force to override all those methods by using interface.

We can achieve multiple inheritance means, we can implement as many interfaces as we want but in java, we can extend only 1 class.. So sometimes its advisable to use interface instead of abstract class dependng on your design.

Yes, we cant write any code in methods of interface. Just declaration. The concrete class that implements interface has to write all the methods.
Hope you find it useful.
10 years ago
Ya but I guess that also will not be the only reason, because its quite understandable when I said him(interviewer)its for validating data. so we can validate means eg: not allowing users to set value to null. I am not saying what you said is wrong but is there anything else with this?
10 years ago
Not sure whether I am writting at correct place or Not:-

Can anyone answer me, Why data members are private when we can access them through getter/setters?. why we dont make it public then?

-I gave answer like, if you want to validate your data, like adding some condition kinda, you can do it by adding just that code in getter and it will reflect everywhere but if it is public we have to change code everywhere..
And same for setter we can have validation like not greater or less than this etc....
But interviewer was still not happy...
Any other addition to my answer?
10 years ago