Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Here's a Laugh...

 
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?
 
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...
 
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
----------------
 
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.
 
Live a little! The night is young! And we have umbrellas in our drinks! This umbrella has a tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
    Bookmark Topic Watch Topic
  • New Topic