The native and synchronized Keywords


The native and synchronized Keywords

Methods can also be declared to be native or synchronized . A native method is one that is written in a programming language other than Java. This book focuses on Java code development, but you may very well have legacy code that you would like to incorporate into your Java programs. For more information on utilizing native code, see Essential JNI: Java Native Interface by Rob Gordon.

A synchronized method is one that ensures thread-safe data access. In other words, two threads would not be able to simultaneously change the value of a variable in a synchronized method. Synchronization becomes a concern when developing multithreaded programs. As that is not a focus of this book, we won't spend any significant time on synchronized methods. For an informative chapter on synchronization, consult Java How-to Program by Harvey M. Deitel and Paul J. Deitel.



Technical Java. Applications for Science and Engineering
Technical Java: Applications for Science and Engineering
ISBN: 0131018159
EAN: 2147483647
Year: 2003
Pages: 281
Authors: Grant Palmer

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net