• 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

package works only with importing individual class??

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have two java test program in different package: one in default package and one in user defined package..when I tried to use the class in the user define package by importing the whole package, compile error occured: can't resolve symbols,for whatever constructor or methods in the imported package. but when i import individual class, everything works perfect. any one knows why??
here is the test program
ReadNumber.java
package user.test;
public class ReadNumber{
public ReadNumber(){
System.out.println("this is a line from ReadNumber2 constructor");
}
public void test(){
System.out.println("this is a line from test() in readNumber");
}
public static void main(String arg[]){
ReadNumber rn=new ReadNumber();
System.out.println("this is a line from main");
}
}
TestReadNumber.java
import user.test.ReadNumber; //compiles fine
//import user.test.*; //this won't compile
public class TestReadNumber{
public static void main (String arg[]){
ReadNumber rn = new ReadNumber();
rn.test();
}
}
anyone have any idea why it happened this way..thanks
 
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Gong
This is only a guess but is your user defined package in a JAR? The * functionality might only work for JARed classes.
Someone else can probably shed more light on it.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic