Something that is easy to make mistakes in java

Source: Internet
Author: User
Some of the things that are easy to make mistakes in java-general Linux technology-Linux programming and kernel information. The following is a detailed description. 1) instanceof: the class object that implements an interface is also an instance of this interface; a certain class object is also an instance of this super class.

2) The native () modifier method does not have a method body. Use a semicolon ";" instead of braces.

3) main is not a keyword.

4) System. exit (int value), that is, if it is an int, the JVM can exit System. exit ('A'); it is also legal.

5) &, | can be used on int and boolean, while ^ (exclusive or) can only be used on int.

6) If a class and an interface are defined in the same file and the class is declared as public, nothing can be written before the interface, because the interface can only be modified using public, one file can only have one public access control keyword.

7) under unreachable statement, unreachable statement may occur.

(1) write the statement after the reutrn statement.

(2) write the statement after the throw statement.

(3) define the statement after the break and continue statements.

8) "\ u10100" // valid, equivalent to '\ u101010' and string "0"

9) The shift operator can be used for long int char short byte 10) Class access control operator can be public or nothing is added.

11) goto is a reserved word but not a keyword. Then is nothing.

12) when the super class type is forcibly converted and assigned to the subclass object, no exception occurs during compilation, but an exception occurs during running.
Related Article

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.