Java控制台程序 [英] Java console program
本文介绍了Java控制台程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道如何制作Java控制台程序。我使用Eclipse作为IDE。寻找与C#版本的控制台程序类似的东西。
I was wondering how to make a Java console program. I use Eclipse as IDE. Looking for something similar to C#'s version of a console program.
尝试过Google,但只发现导出到JAR并从命令行解决方案执行。我希望在控制台窗口中进行编译和直接测试。
Tried Google but only found export to JAR and execute from command line solutions. I would prefer to compile and directly test in a console window.
预先感谢
推荐答案
/*
* put this in a file named CommandLineExample.java
*
*/
class CommandLineExample
{
public static void main ( String [] arguments )
{
System.out.println("Hello, world");
}
}
在命令行中键入以下内容进行编译:
type the following from the command line to compile it:
$ javac CommandLineExample.java
然后您可以从命令行像这样运行它:
then you can run it from the command line like this:
$ java CommandLineExample
这篇关于Java控制台程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文