JavaSE-a simple program inspired new users

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.