File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes interface fields Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "interface fields" Watch "interface fields" New topic
Author

interface fields

richerd gladius
Greenhorn

Joined: Mar 22, 2007
Posts: 7
Hi All,
if we have a interface with some fields and all the class is implementing that interface does in each class will create a reference for the static fields or it will not do it?
is it good to do like this
interface a{
int aa=0;
}
class b implemets a{
Sysem.out.println(aa)
}

or

class c{
Sysem.out.println(a.aa)

}

either doing like class c is better or class a
Maurizio Nagni
Ranch Hand

Joined: May 29, 2004
Posts: 75
The aa variable is implicitely public static final both are correct (if you remember to add a method to your classes and commas).
The advantage of the a.aa style is that the code is easier to read because you know from where it came the aa parameter.
Just a final note: do not start class names with non-capital letter... it is better you get used to some java standard
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: interface fields
 
Similar Threads
instanceof prblem help me
intermediate submit and validation of a form
[Generics] circular generic classes declaration
Abstract class..
doubt in casting