GDawson
GDawson

Reputation: 337

Method call to another file

I have two files:

I wanted to learn how to call the file "Test.java" a method that is in another file "other.java"

Thank you!

Upvotes: 9

Views: 38093

Answers (1)

user
user

Reputation: 87074

You either create an object of type Other and then call the method on that object:

//in the Test class

    Other obj = new Other();
    obj.methodFromOther();

or if the method is static just call:

//in the Test class

    Other.methodFromOther();

Maybe you should follow this tutorial to learn about the java programming language.

Upvotes: 20

Related Questions