Beginners how to learn Java programming need to know what the core technology

Beginners how to learn Java programming? What are the core technology need to know? Java is a pure object-oriented programming language, it inherits the core object-oriented C ++ language technology. C language Java discarded easily cause an error pointer (substituted by reference), operator overloading (operatoroverloading), multiple inheritance (substituted in the interface) and other features, the garbage collector adds the object function for recovering the occupied unreferenced memory space, so that programmers no longer need to worry about memory management.

Every time I see there are many online want to learn java technology partners are looking for a small number of books and videos, as a beginner, to see how this kind of books are more suitable for it? Or, how can we ease of entry but also in-depth study of it? of course this is not a book will be able to solve the matter. Feng give below one thousand share with you "Java core technology," this book, some thoughts will learn to chat with you.

 

Beginners how to learn Java programming need to know what the core technology

 

A, Hash Code default method is to call the object's address, if you override the equals method should override hash Code method, such as your equals method is to compare the ID of the object, use the ID of the object's hash.

Two, instanceof not perfect, like father and son can not be found, so when writing equals method should be relatively lower if the same class. .

Three, String class and the value of the packaging is not changed, so if you want to realize their need to pass a reference Holder classes StringHolder class and packaging, such as: IntHolder.

Four, C # delivery method may delegate the pointer reflection invoke methods in JAVA method is completed.

Fifth, do not use the protected modified field since have access to the entire package, break encapsulation.

Six, throwable class that implements the interface has two branches, one error, an internal error or resource generally JAVA system is exhausted, for which, in addition to user error notification and allow users to safely exit outside no other way. There is another exception, is divided into Runtime Exception and non Runtime Exception. Since the error in the program led to the emergence of abnormal called Runtime Exception, this problem should be resolved and avoided in the program, you should not throw an exception. And had been able to function properly, there may be caused by abnormal called non Runtime Exception, to solve this problem should be thrown at some point. Common Runtime Exception type conversion error there, array bounds, null pointer and so on. If Runtime Exception occurs it must be your problem. Runtime Exception Error and called unchecked exceptions. Rather Runtime Exception called checked exceptions.

Seven, to be exact use of floating-point operations Use Big Decimal. Note the use of time division decimal places, otherwise it will lead to error values ​​are not accurate.

Eight, do not recommend using char in the program, because char using utf-16 encoding.

Nine, three treatments error mechanisms: abnormal, logging and assertions. java turned off by default use of assertions, want to use the jvm parameters should be used -ea running. For example: int x = 5; x is greater than 0 is determined to be used assert x> 0: x; should not be used to assert recoverable error has occurred in the program. Assertions can only be used in the development and testing phase. Is a tactical tool, the log is throughout the entire life cycle of a strategic tool.

Ten, in addition to serialize simple objects can be stored outside, complex objects also have a good approach, for example, if the common reference in a shared object when several objects, this will not save the shared object several times, but check whether save this share, if not then saved, if you have saved, saved a serial number of the object.

XI can be used alone in a generic non-generic class, for example, a generic method: public static void test (T t) {}, and you can use a plurality of generic interfaces, for example: public statci void test (T t ) {}. Can be defined using generic superclass, it is the opposite, for example, defining subclasses: public class Pair, but he can provide parameters to the method, the return value can not be used. In general, with the generic superclass can be written to the subject, with the generic subclass can be read from an object, for example: public static> T min (T [] a) {}.

Only with real Java development technology, in order to gradually become a Senior Java Development Engineer. Prospects for the development of Java is no doubt, if you want to enter this field, "suck money" and choose a professional learning is a wise move.

Guess you like

Origin www.cnblogs.com/qianfengzz/p/11738466.html