Because he defines interfaces as class definition / object pattern solely. Using interfaces for constant definition doesn't fit this purpose.
However, it was not ment for this case: public interface MyInterface { public static final String YES = "yes"; } What you shouldn't define in interface are implementation specific constants like public interface MyInterface { public static final int RETRY_OPERATION_X_BEFORE_FAIL = 3; public void operationX() throws Exception; } This is an implementation detail and should be defined in the implementing class, because it's not common to all implementations. The thread initiation example was ok according to bloch. Regards Leon > -----Ursprüngliche Nachricht----- > Von: Frank W. Zammetti [mailto:[EMAIL PROTECTED] > Gesendet: Samstag, 22. Januar 2005 19:57 > An: Struts Users Mailing List > Betreff: Re: constants interface > > David, I'm snowed in today here in Pennsylvania, so I can't > go out and get that book :) > > Can you enumerate some of the reasons Bloch advocates this? > It seems like a reasonable thing to suggest, I'd like to know > his rationale for it though. > > -- > Frank W. Zammetti > Founder and Chief Software Architect > Omnytex Technologies > http://www.omnytex.com > > David Bolsover wrote: > > It is worth taking a look at the excellent book 'Effective Java' by > > Joshua Bloch - he outlines a number of reasons for avoiding the > > constant interface pattern and instead advocates the use of > a constant utility class as in.. > > > > public class MyInterface { > > public static final String YES = "yes"; } > > > > db > > > > > > -----Original Message----- > > From: Carl Smith [mailto:[EMAIL PROTECTED] > > Sent: 22 January 2005 15:50 > > To: user@struts.apache.org > > Subject: constants interface > > > > > > In Java, sometimes you would define an interface containg > the constants: > > > > public interface MyInterface { > > public static final String YES = "yes"; } > > > > To access the contants, there are two ways > > > > public class WayOne { > > public void myMethod(){ > > String yes = MyInterface.YES; > > //... > > } > > } > > > > public class WayTwo implements MyInterface { > > public void myMethod(){ > > String yes = YES; > > //... > > } > > } > > > > I am asking which one is better? Or they are Ok and depend on the > > developer 's flavor? > > > > > > > > signature > > > > --------------------------------- > > Do you Yahoo!? > > Yahoo! Search presents - Jib Jab's 'Second Term' > > ======================================================= > > This message has been scanned for viruses and dangerous > content using > > Vet Anti-Virus Protection and is believed to be clean. > > ======================================================= > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]