Java Reference
In-Depth Information
To declare a native method, precede the method with the native modifier, but do not
define any body for the method. For example:
Once you have declared a native method, you must provide the native method and follow a
rather complex series of steps in order to link it with your Java code.
Ask the Expert
Q :
While we are on the subject of keywords, I have a question about this. I have oc-
casionally noticed a form of this that takes parentheses. For example ,
Can you tell me what this does?
A : The form of this that you refer to enables one constructor to invoke another con-
structor within the same class. The general form of this use of this is shown here:
this( arg-list )
When this( ) is executed, the overloaded constructor that matches the parameter list
specified by arg-list is executed first. Then, if there are any statements inside the original
constructor, they are executed. The call to this( ) must be the first statement within the
constructor. Here is a simple example:
Search WWH ::




Custom Search