• 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:
  • Devaka Cooray
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
Bartenders:

problem with custome package

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi im narendra
im new to java..
i have a problem in importing custome package

the following 2 programs

1) hello.java
package wish;
public class hello
{
public static void call()
{
System.out.println("Hello World!");
}
}

2) wishing.java

import Wish.*;
public class Wishing
{
public static void main(String[] args)
{
hello.call();
}
}
it is giving me error
Wishing.java:7: cannot access hello
bad class file: .\hello.java
file does not contain class hello
Please remove or make sure it appears in the correct subdirectory of the classpa
th.
hello.call();
^
1 error
[ November 08, 2005: Message edited by: billakanti narendra ]
 
Ranch Hand
Posts: 53
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Narenda!

Your class hello is in the package wish. So you have to import the package wish.hello in your class Wishing to access the static method call.

Ernie
 
Paper jam tastes about as you would expect. Try some on this tiny ad:
The new gardening playing cards kickstarter is now live!
https://www.kickstarter.com/projects/paulwheaton/garden-cards
reply
    Bookmark Topic Watch Topic
  • New Topic