(C) Hello, World!

Finally managed to enter the JAVA programming first step, insisting here that you really like to learn JAVA too! (Of course, I can not not learn to write homework

Man of few words said, quickly began our first program of it!

first step:

First, just pick a place, create a new file Hello_World.txt

Wrote in the document, so that says it first, back to the time of object-oriented programming will explain. (Although I learned C ++ already know what these are

 

class our Hello_World {\\ Note that the class name and file name to the same Oh
     public  static  void main (String [] args) {// String uppercase
        System.out.println ( "the Hello, World!" ); // System uppercase
    }
}

 

Here are a few points to note:

1. class names need to be consistent with the source file

Case 2. JAVA code is case-sensitive, attention code

3. A file can have only one public static void main (String [] args)

 

Step two:

After the txt suffix to the Java , the file name becomes Hello_World.java (if there is no extension, then on Baidu

 

third step:

 

 Enter a place in the blue cmd  and press Enter

 

 

After the jump there will be a command line, enter

javac Hello_World.java

 

 If the compiler can run the next step, enter the command line

java Hello_World

 

 

Can be output:

Hello, World!

Guess you like

Origin www.cnblogs.com/Vikyanite/p/12360117.html