wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Here's  a Laugh... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Here Watch "Here New topic
Author

Here's a Laugh...

Sam Smoot
Ranch Hand

Joined: Apr 18, 2002
Posts: 238
How do I call a method from an external class that isn't in a package?


CNSS/NSA Infosec Professional,<br />Software Engineer
Sayed Ibrahim Hashimi
Ranch Hand

Joined: May 17, 2001
Posts: 148
That depends, give us the signature of the method. Because we need to know what access modifier the method has. It may not even be possible.


SCJP 1.4<br /><a href="http://www.cise.ufl.edu/~sih" target="_blank" rel="nofollow">www.cise.ufl.edu/~sih</a>
Sam Smoot
Ranch Hand

Joined: Apr 18, 2002
Posts: 238
This should probably be in applet discussion, but I'm new...
This is the external class:

My Applet is:

Any Ideas (solutions)?
[ May 13, 2002: Message edited by: Dirk Schreckmann ]
Sam Smoot
Ranch Hand

Joined: Apr 18, 2002
Posts: 238
Never mind...
Dang capital letters...
khella smith
Ranch Hand

Joined: May 06, 2002
Posts: 39
did u try importing the method?
if it is in a different package i think u can import the package in the current package which will enable u to import the method i am not so sure cause i haven't tried it before but i wouldn't hurt to try
if i am wrong i stand corrected
and would like to know too
----------------
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
It's always nice to trouble shoot one's own code and find the problem. Good job.
For the curious, a good place to brush up on understanding access-permission concepts is the Controlling Access to Members of a Class lesson in Sun's Java Tutorial.
As you've noted, Java is case sensitive and this has surely led to frustration and confusion to more than one Java novice. For a nice list of more things to be careful of when programming, check out Roedy Green's article on How To Write Unmaintainable Code.
While your question did involve an applet, it was not applet specific and this conversation definitely belongs in the beginner's forum.
[ June 12, 2002: Message edited by: Dirk Schreckmann ]

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Regarding khella's questions and comments:
In Java, we import and package classes (and packages). Access to the methods of a class are subject first to the available access to the class, then according to the rules outlined in Sun's lesson referenced above.
 
 
subject: Here's a Laugh...