Java java basic structure [Lesson]

The basic structure of a .java

 

 The above is the basic java, including the outer frame, framework inlet java

 

 

The first program of two .java

First, create a file, called helloworld.java, java suffix.

public  class HelloWorld {// file name and the name of the same class
      public  static  void main (String [] args) {
         System.out.println ( "I want to learn the Java" );        
   
    }
}

 

Run the program

 

 

Open a command window

 

 

There is a question above is garbled, at compile time to add parameters -encoding utf-8

 

 

III. Data Types

Overall value and is non-numeric

public class helloworld{
     public static void main(String[] args){

          int Number = 10;   // variable variable value type variable names 
         System.out.println (number);        
   
    }
}

 

IV. Variable Name Rules

According to the above configuration diagram, you must know the first letter is a letter, underscore, a $ symbol.

 

Guess you like

Origin www.cnblogs.com/Crown-V/p/12362859.html