• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HELP!!! how do I call methods from a class????

 
Bernard Shapiro
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the App class how do I call methods that are created in another class that I created? What is the syntax?
i.e. I have a Student class with a find() method... How do I call this from the App class???
 
Shraga van Shufel
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try Student.find();
or to initiate a new Student object
Student s = new Student();
s.find;
however you need to import your Student class if they are not in the same package.
/Shraga
 
Francis Siu
Ranch Hand
Posts: 867
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Bernard

From the App class how do I call methods that are created in another class that I created? What is the syntax?

Firstly,I want to know another class is the same folder or not,in the following example,I assume the two class is in the same folder and differ file.
First class call App.java and another call Student.java
In the App class

In the Student class

I hope that this example can answer your question
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic