Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Beginning Java
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
paul wheaton
Liutauras Vilda
Ron McLeod
Sheriffs:
Jeanne Boyarsky
Devaka Cooray
Paul Clapham
Saloon Keepers:
Scott Selikoff
Tim Holloway
Piet Souris
Mikalai Zaikin
Frits Walraven
Bartenders:
Stephan van Hulst
Carey Brown
Forum:
Beginning Java
variavle declaration in interface
vijay kumarg
Ranch Hand
Posts: 105
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Is it mandatory to intialize a variable declared in an interface?
Mathias Nilsson
Ranch Hand
Posts: 367
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Yes! I think they are.
Try comiling a interface with a variable that is not instanciated and you will get a compile error
= expected
SCJP1.4
Peter Chase
Ranch Hand
Posts: 1970
1
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
You can't declare variables in interfaces. You can only have public static final fields - i.e. constants. These must be given a value within the interface.
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
Jeroen T Wenting
Ranch Hand
Posts: 1847
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
And you shouldn't do that... Effective
Java
, topic 17.
42
You know it is dark times when the trees riot. I think this tiny ad is their leader:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Writing an Interface
Time Capsule
Regarding Interfaces
How To Call Two Different Classes From the Main Program Using the Same API?
Home interface or Home Interface stub
More...