Forums Register Login

write interface in a class

+Pie Number of slices to send: Send
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");
}

}
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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?
+Pie Number of slices to send: Send
 

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
I can't take it! You are too smart for me! Here is the tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 528 times.
Similar Threads
Problem with a static method in a class
Difference between hashCode() and equals()
Equals and HasCode
Objects eligible for GC
HashMap
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 18:31:36.