wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Package level constructor ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Package level constructor ?" Watch "Package level constructor ?" New topic
Author

Package level constructor ?

Pho Tek
Ranch Hand

Joined: Nov 05, 2000
Posts: 761

I wrote a simple javabean class:-
package a.b.c;
public class Foo{
int i;
Foo(){ i = 1000; }
void setI(int i){ this.i = i; }
int getI() { return(i); }
}
And in a servlet; it failed to load the class Foo
via a:
Class.forName( a.b.c.Foo );
I don't understand what the package level access modifier
does to a class constructor. Note that I am able to instantiate
the class Foo like this:
Foo f = new Foo();
Pho


Regards,

Pho
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Pho,
There is not quite enough information here for us to follow. Where does the directory reside - client side or server side?
What is the code that didn't work?? What was the error given?
I'm afraid that it SOUNDS like you have the package on the client side with the GUI, and are trying to access it from the server side (Nope won't work). This of course had nothing to do with constructors, just architecture.


"JavaRanch, where the deer and the Certified play" - David O'Meara
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Package level constructor ?