如何调用java方法 [英] How to call java method
本文介绍了如何调用java方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的朋友,我有一个关于方法调用的问题。这是我的代码,我很困惑,在学生班上称这种方法。
我尝试过的方法:
Dear friends i have one problem about method calling. here is my code and iam confused to call this method in student class.
What I have tried:
package assignment3;
import java.text.SimpleDateFormat;
import java.util.Comparator;
import java.util.Date;
public class student implements Comparable
这是我需要从学生班级打电话的方法
this is the method that i need to call from the student class
private static String [] compareDOB(student[] students){
//Comparator
推荐答案
因为它是一个静态方法,你可以打电话这样:
Since it is a static method, you may call it this way:
String [] result = classname.compareDOB( students );
其中:
-
学生
是学生的
对象。 -
classname
是一个实现compareDOB
方法的实际类的占位符(您没有说明哪个类实际实现它)。 students
is an arary ofstudent
objects.classname
is a placeholder for the actual class implementing thecompareDOB
method (you didn't state which class is actually implementing it).
where:
这篇关于如何调用java方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文