JavaSE-a simple program inspired new users
A simple program:
Question: now we have completed a simple program that can output the multiplication of two numbers.
Public class TestJava {public static void main (String args []) {int num = 10; // defines the integer variable num = 30; // modifies the variable content System. out. println ("num content:" + num); System. out. println ("num * num =" + num * num );}};
Differences between using public class and class Declaration <喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> VcD4KPHA + signature + 7PGsdjQ69PrwODD + signature + oaQgY2xhc3POxLz + w/uzxr/J0tTT68Dgw/Signature + 16LS4qO61NrV + signature/Signature = "http://www.2cto.com/uploadfile/Collfiles/20140827/20140827085757258.jpg" alt = "\">
If the public class is not used, for example:
The compiled result is as follows:
Multiple class definitions are allowed in a Java file. Different classes are automatically divided after compilation.
When writing a Java program, the class name must be written in a certain format: the first letter of all words must be capitalized. (Professional is embodied here)
Java program notes:
· Single line comment ://...
· Multi-line comment :/*...*/
· Document notes :/**...*/
Java identifier)
Note: If you do not want to remember these rules, it is recommended that you use English letters to complete the process. Example: TestJava
Keywords in Java:
In Java, goto and const have no meaning
2. Added assert after JDK 1.4.
3. enum is added after JDK 1.5.