Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!