Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Java in General
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:
Tim Cooke
Campbell Ritchie
Ron McLeod
Junilu Lacar
Liutauras Vilda
Sheriffs:
Paul Clapham
Jeanne Boyarsky
Henry Wong
Saloon Keepers:
Tim Moores
Tim Holloway
Stephan van Hulst
Piet Souris
Carey Brown
Bartenders:
Jesse Duncan
Frits Walraven
Mikalai Zaikin
Forum:
Java in General
how to access class defined in an interface
amarnath jha
Greenhorn
Posts: 18
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
how can i access a class defined in an interface?
public interface abc
{
static int i=0; void dd();
class a1
{
a1()
{
int j;
System.out.println("inside");
}
public static void main(
String
a1[])
{
System.out.println("in interfia");
}
}
}
amod gole
Ranch Hand
Posts: 83
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi all,
You can access that class by using interface name
like
inte.ClassName o1=new inte.ClassName();
amod gole
Ranch Hand
Posts: 83
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
hi amarnath jha ,
You can also defind
interface inside class
then question is how to access that interface?
again same rule class name . interface name
Enjoy
wise owen
Ranch Hand
Posts: 2023
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
A class defined inside an interface is implicitly static.
amod gole
Ranch Hand
Posts: 83
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
wise owen exactly......
inner class always behave like an data variable of that class
and by default all variable which are declared in interface are final and static...
this means that ,that class is also static class
so you can access that class using inteace name
amarnath jha
Greenhorn
Posts: 18
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
any other information regarding the class declared in an interface
Ernest Friedman-Hill
author and iconoclast
Posts: 24204
44
I like...
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
As was stated previously, such a class is implicitly static:
interface I { class C {} } ... I.C ic = new I.C();
[Jess in Action]
[AskingGoodQuestions]
Don't get me started about those stupid
light bulbs
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
accesing variable of default package inside the package class
Accessing instance variable inside static reference.
arrays
question about the class declaration.
interface
More...