How to judge the efficiency of Java code

I just realized that from a computational point of view, I don't know how to judge whether a piece of Java code is valid Reading several source codes, sometimes I think the code I'm reading is very inefficient, sometimes I think the opposite

Can you list the basic single line rules and why they are so important?

Edit - my problems are related to the Java implementation of the JVM, such as Java allocation, string management, exception handling, thread synchronization, etc

Thank you in advance

PS: don't take the literal meaning of "single line"

Solution

If you really need a list of rules you should follow in Java, please check Joshua Bloch's Book Effective Java This book not only provides a performance guide, but also provides the correct method of Java programming

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>