By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,950 Members | 1,019 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,950 IT Pros & Developers. It's quick & easy.

simple scope question

P: n/a
nos
I have two files in the same directory which is '.'
I have a method in file1 that I invoke from a
method in file2. Why do I have to use
class1.method1() instead of just method1().
The class1.method1() is public. Neither file
has a package statement so the default
package is used.
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Cause you are calling a method on a different object...
On Wed, 04 Feb 2004 23:07:53 GMT, "nos" <no*@nospam.com> wrote:
I have two files in the same directory which is '.'
I have a method in file1 that I invoke from a
method in file2. Why do I have to use
class1.method1() instead of just method1().
The class1.method1() is public. Neither file
has a package statement so the default
package is used.


Jul 17 '05 #2

P: n/a
Don't talk about files.

In JAVA you have classes.
JAVA chose to put different classes into different
files with extension .class but it's only an implementation
choice!

Now the problem is class scope and not file path scope!

Luca Paganelli

"nos" <no*@nospam.com> wrote in message
news:dXeUb.180101$nt4.777913@attbi_s51...
I have two files in the same directory which is '.'
I have a method in file1 that I invoke from a
method in file2. Why do I have to use
class1.method1() instead of just method1().
The class1.method1() is public. Neither file
has a package statement so the default
package is used.

Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.