• 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

compile interface error

 
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you have the current directory in your classpath when you compile and run it?
 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks David,Richard...
I forgot set current directory to classpath.now it is ok.thanks
 
reply
    Bookmark Topic Watch Topic
  • New Topic