Java Common knowledge (long-term update)

Source: Internet
Author: User

1.0 Escape Character

\ n: newline, \ nthe function is the same as ln behind print, and can be used as appropriate

\ t: A tab stop (a series of spaces)

Cases:

1  Public classschedule{2      Public Static voidMain (string[] args) {3SYSTEM.OUT.PRINTLN ("\t\t* Timetable *");4System.out.println ("--------------------------------------------------");5SYSTEM.OUT.PRINTLN ("Week \ t \t\t pm");6System.out.println ("--------------------------------------------------");7System.out.println ("Monday \ t English \t\t high number");8System.out.println ("Tuesday \ t political \t\t computer network");9System.out.println ("Wednesday \tc++\t\tjava");TenSystem.out.println ("Thursday \ t data structure \t\tjava"); OneSystem.out.println ("Friday \ t database \t\t operating system"); ASystem.out.println ("--------------------------------------------------"); -     } -  the}

This code outputs effects such as:

What are the annotation types for 2.0 Java?

Parsing: The role of annotations: 01. Facilitate later maintenance of the project

02. Facilitate the reading of members within the team

03. Comments will not be compiled by the Java compiler, Java compilation will be skipped comments

Why write comments: In order to follow us to read the code convenient, so we have to develop the habit of writing notes,

Because the comments accounted for three points during the final exam, the comments accounted for a large proportion during the interview.

First: single-line Comment//shortcut: ctrl+/

The second type: Multiline comment/**/shortcut key: ctrl+shift+/

If the cursor renders a relatively wide style, press the INSERT key on the keyboard to restore the cursor.

3.0 notes for writing Java programs:

01.java code is strictly case sensitive.

02. Curly braces to appear in pairs

03. Write the left curly brace ({) At the end of a line of code

04. The code should be written into the inner frame.

05. All the code we write is in the English half-width state, otherwise error may occur

Each statement in 06.java is separated by a semicolon ";" End

07. Class names cannot start with a number

-------------------------------above updated on 2015.07.24

Java Common knowledge (long-term update)

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.