• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

write interface in a class

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi to all , Iam new to java world, here is the my program , this is getting compile time erors, iam unable to understand, please any one give instructions to me how to write interface in a class


public class D2 {
static inteface I
{
static class D3
{

}
}

public static void main(String[] args) {

D2.I.D3 obj=new D2.I.D3();
System.out.println("objected created");
}

}
 
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to TellTheDetails.(⇐click) Copy/paste the exact, complete error message, and indicate clearly which line is causing it.

Also, when you post code, please UseCodeTags(⇐click) so that it will be readable.
 
Slaxmi Raj
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1 public class D2 {
2 static inteface I
3 {
4 static class D3
5 {
6 }
7 }
8 public static void main(String[] args) {
9 D2.I.D3 obj=new D2.I.D3();
10 System.out.println("objected created");
11 }
12
13 }
ERROR

Exception in thread "main" java.lang.Error: Unresolved compilation problems:
D2.I cannot be resolved to a type
D2.I cannot be resolved to a type
at D2.main(D2.java:9).
These are the compilation errors.please tell me how i resolved this?
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Slaxmi Raj wrote:These are the compilation errors.please tell me how i resolved this?


Have a look at line 2 again, carefully.

Also, as said before: Please UseCodeTags (←click).

Winston
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic