Java Programming - Language Fundamentals - Discussion

Discussion Forum : Language Fundamentals - General Questions (Q.No. 4)
4.
Which is a reserved word in the Java programming language?
method
native
subclasses
reference
array
Answer: Option
Explanation:

The word "native" is a valid keyword, used to modify a method declaration.

Option A, D and E are not keywords. Option C is wrong because the keyword for subclassing in Java is extends, not 'subclasses'.

Discussion:
25 comments Page 1 of 3.

Disha said:   1 decade ago
Hey, could you please give an example of using "native" keyword?.

Ijaz said:   1 decade ago
I want simple program for 'native' keyword?

Shubhrendu said:   1 decade ago
Its the example of native method............


import java.util.*;

class ReadFile {
//Native method declaration
native byte[] loadFile(String name);
//Load the library
static {
System.loadLibrary("nativelib");
}

public static void main(String args[]) {
byte buf[];
//Create class instance
ReadFile mappedFile=new ReadFile();
//Call native method to load ReadFile.java
buf=mappedFile.loadFile("ReadFile.java");
//Print contents of ReadFile.java
for(int i=0;i<buf.length;i++) {
System.out.print((char)buf[i]);
}
}
}

Kathirozhi said:   1 decade ago
Program cannot be run write by Shubhrendu.

please tell the output of that program.

Vishal kumar singh said:   1 decade ago
When we can modify the method declaration using "native" keyword in java ?

Bharathi said:   1 decade ago
Can you please give clear explanation about of native keyword ?

Yogesh pawar said:   1 decade ago
What is use of native method, where we will be use it?

Anuj said:   1 decade ago
May you tell me where do we use native keyword?

Mahendra said:   1 decade ago
The word "native" is a valid keyword, used to modify a method declaration.

Explanation is like this then where did you modify method declaration in that program.

Rahul yadav said:   1 decade ago
All machine code define inside native.


Post your comments here:

Your comments will be displayed after verification.