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 3 of 3.

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

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

please tell the output of that program.

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]);
}
}
}

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

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


Post your comments here:

Your comments will be displayed after verification.