• Post Reply Bookmark Topic Watch Topic
  • New Topic

write interface in a class  RSS feed

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!