Home > Java > javaTutorial > body text

Java Example - How to execute compiled Java files

黄舟
Release: 2017-02-21 09:45:44
Original
1277 people have browsed it

In this article we demonstrate how to execute the compiled HelloWorld.java file, where the Java code is as follows:

public class HelloWorld {
    public static void main(String []args) {
       System.out.println("Hello World");
    }}
Copy after login

Next we use the javac command to compile the Java file. After executing the command, it will be in the current directory A HelloWorld.class file will be generated. We can use the java command to execute the compiled file:

c:\jdk\demoapp> javac HelloWorld.java
c:\jdk\demoapp> java HelloWorld
Copy after login

The output result of the above code example is:

Hello World
Copy after login

The above is the Java example - how to perform compilation Through the contents of the Java file, please pay attention to the PHP Chinese website (www.php.cn) for more related content!


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!