Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

compile interface error

 
qingwu wang
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello.java //it is a interface



HelloWorld.java

above two java file are in the same directory.when I compile Hello.java,it passed,then I comile HelloWorld.java,exist error one,[error]
HelloWorld.java:cannot resolve symbol
symbol:class Hello
location:class HelloWorld
public class HelloWorld implemnets Hello
1 errors
[/error]


but when I do it as following,compile well.

reslt rint dog
I dunno the reason.help me!
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have the current directory in your classpath when you compile and run it?
 
Richard Teston
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think because you must have one public class or interface per source file
if you want your interface to be public you should place it on a different file named like your interface identifier, But if you want to put them on the same source file you must use default access modifier for your interface
 
qingwu wang
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks David,Richard...
I forgot set current directory to classpath.now it is ok.thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic