No-use Java language features

Source: Internet
Author: User

A reader and author on Javalobby, after reading the Java top Ten most useless features, also lists the features of the Java language that no one uses in his mind, and we can also come here to review

Before, I read the "Java10 most useless feature" of Anthony Goubard on Javalobby. I agree with some of his options, but I think he ignores some of the key features that nobody uses. I limit myself to language level features (APIs are too large), and here are 4 other Java features that are not used.

1. Strict floating-point numbers

Maybe somewhere, the Java STRICTFP keyword is important to a programmer, but I haven't met him/her yet. If you know how to use STRICTFP, you are probably the top 5% Java programmers. If you don't know strictfp, you should look here and welcome to the top 5%. But it's basically necessary to make sure that your calculations are wrong on all platforms.

2. Local class

Java has 4 kinds of internal classes, of which 3 are widely used. Like static inner classes, named inner classes, and anonymous inner classes, you can also define named classes within a method, although this is rarely seen in reality.

public class TopLevelClass
{
    public void someMethod()
    {
        class LocalClass
        {
            // Some fields and methods here.
        }

        LocalClass forLocalPeople = new LocalClass();
    }
}

3. Eight literal quantity

Who will use the octal number now? Hexadecimal is more convenient for binary values. Worse, the octal literal, beginning with 0, is confusing:

int a = 60;
int b = 060;
System.out.println(a + b); // Prints 108.

4. Short Data type

You're using it? I don't believe it. Everyone uses int when he wants to use an integral type, even if they don't need a 32-bit range.

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.