您的位置 首页 java

多学习才能多赚钱之:如何运行java 程序

如何运行 java 程序

1、首先我们需要一段java程序,一个简单的Hello Java为例:

public class HelloJava{

public static void main(String[] args){

System.out.println(“Hello Java”);

}

}

把上述代码保存为.txt文档后,将后缀名改为.java(推荐学:java课程)

得到文件如图:图标不一样不要紧后缀相同即可。

2、接下来我们在同级这个文件的目录下按住shift+右键,打开命令行

3、我们使用 javac 命令来生成可在命令行执行的.class文件,如图:

(Ps:要注意输入的时候把后缀名带上哦)

执行后显示如下:

可以看到在我们的桌面上已经生成了一个同名的.class文件:

4、那么我们要如何执行它呢?使用java命令:

可见我们代码里要求的输出“Hello Java”。

以上就是如何运行java 程序的详细内容,更多请关注其它相关文章!

更多技巧请《转发 + 关注》哦!

文章来源:智云一二三科技

文章标题:多学习才能多赚钱之:如何运行java 程序

文章地址:https://www.zhihuclub.com/181526.shtml

关于作者: 智云科技

热门文章

评论已关闭

7条评论

  1. Therefore, to acquire Letrozole in the US to use alongside anabolic steroids means resorting to illegal means

  2. Compared with acute renal injury, intrarenal oxygenation in chronic renal failure has been relatively little studied

  3. Next, we will see who has supplement for low libido a deeper understanding Conclusions Social deprivation increases the chance of a CHF patient being rehospitalised independently of disease severity

  4. Your physician will also what is blood sugar acronym Blood Sugar Levels Chart By Age include all the information in the

  5. Though confirmation of microlithiasis and anatomic variants of the pancreas such as papillary stenosis and sphincter of Oddi dysfunction are most accurately obtained using endoscopic ultrasonography, magnetic resonance cholangiopancreatography or sphincter of Oddi manometry 20, these procedures were not pursued in our patient because of his clinical presentation and subsequent improvement

网站地图