This week's giveaway is in the Spring forum.
We're giving away four copies of Learn Spring Security (video course) and have Eugen Paraschiv on-line!
See this thread for details.
Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Here's a Laugh...

 
Sam Smoot
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I call a method from an external class that isn't in a package?
 
Sayed Ibrahim Hashimi
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Sam Smoot
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 238
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Never mind...
Dang capital letters...
 
khella smith
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic