File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Package level constructor ?" Watch "Package level constructor ?" New topic

Package level constructor ?

Pho Tek
Ranch Hand

Joined: Nov 05, 2000
Posts: 782

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();


Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
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
I agree. Here's the link:
subject: Package level constructor ?
It's not a secret anymore!