从这里引用:
A “Driver class” is often just the class that contains a main. In a
real project, you may often have numerous “Driver classes” for testing
and whatnot, or you can build a main into any of your objects and
select the runnable class through your IDE, or by simply specifying
“java classname.”
例:
这不是驱动程序类,因为它不包含任何main方法.在这种情况下,它有“hello”方法:
public class HelloWorld {
public void hello() {
System.out.println("Hello, world!");
}
}
与这一个 – 这是一个驱动程序类,因为它包含一个main方法,并且是运行HelloWorld的类:
public class HelloWorldDriver {
public static void main(String[] args) {
HelloWorld sayhello = new HelloWorld();
sayhello.hello();
}
}
因此,名称“驱动程序类” – 作为类HelloWorldDriver“驱动”或更确切地说,控制类HelloWorld的实例化和使用.
最后
以上就是眼睛大指甲油最近收集整理的关于java开发驱动_Java驱动程序?的全部内容,更多相关java开发驱动_Java驱动程序内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复