Java Programming - Language Fundamentals - Discussion

Discussion Forum : Language Fundamentals - General Questions (Q.No. 2)
Which one of these lists contains only Java programming language keywords?
class, if, void, long, Int, continue
goto, instanceof, native, finally, default, throws
try, virtual, throw, final, volatile, transient
strictfp, constant, super, implements, do
byte, break, assert, switch, include
Answer: Option

All the words in option B are among the 49 Java keywords. Although goto reserved as a keyword in Java, goto is not used and has no function.

Option A is wrong because the keyword for the primitive int starts with a lowercase i.

Option C is wrong because "virtual" is a keyword in C++, but not Java.

Option D is wrong because "constant" is not a keyword. Constants in Java are marked static and final.

Option E is wrong because "include" is a keyword in C, but not in Java.

62 comments Page 1 of 7.

Indrajeet Singh said:   7 years ago
You may see keywords list of java after seeing that you will get the correct answer.

Java Language Keywords

Here is a list of keywords in the Java programming language. You cannot use any of the following as identifiers in your programs. The keywords const and goto are reserved, even though they are not currently used. true, false, and null might seem like keywords, but they are actually literals; you cannot use them as identifiers in your programs.

abstract continue for new switch
assert*** default goto* package synchronized
boolean do if private this
break double implements protected throw
byte else import public throws
case enum**** instanceof return transient
catch extends int short try
char final interface static void
class finally long strictfp** volatile
const* float native super while

Thiru said:   1 decade ago
Goto is not used in java because,

In older language(BASIC,COBOL) are "program driven languages where program logic drives the users, so they decide the flow, hence need "GoTo".

But todays, languages, are "Event driven languages", where application's objects (menu, buttons, form elements ...) are listening user's response and go by it.

Naresh.K said:   1 decade ago
The final is a keyword. This is similar to const keyword in other languages. This keyword may not be used as identifiers i.e. you cannot declare.

Native is a Java keyword that is used in method declarations to specify.... This keyword signals to the Java compiler that the function is a native language.

Lishit said:   1 decade ago
Instanceof is an operator which operates on an object and determines whether it belongs to the same class. So its not a keyword. While keyword are reserved words which can be used for achieving certain situation which doesn't give any result so instanceof is an operator.

Sagar shinde said:   5 years ago
I think (A) is correct answer because the all keyword in answer (A) is used in java, as your answer (B) the GOTO keyword is not used in java. Because the flow of execution of program in java use bottom-up approach and it does not support the GOTO keyword.

Vaibhav Kotiyal said:   1 decade ago
Native Keyword indicate That the method is written in Platform dependent language Such As C.

We can Say that if we want to use method that is written in another Language and we wanna to use then native keyword overcome this problem.

Anu said:   1 decade ago
strictfp is a keyword in the Java programming language that restricts floating-point calculations to ensure portability. It was introduced into Java with the Java virtual machine (JVM) version 1.2.

Deep Vakharia said:   9 years ago
Goto is not used in java and as an alternative java has provided us inner and out loop function we can break the loop that we want to. So there's no use of goto in Java.

Saurabh said:   3 years ago
Though goto is not a frequently used keyword, still a keyword,

And here, the question is which has only one keyword (whether used or not used is not mentioned).

Swarna said:   1 decade ago
Siva: finally is a keyword, used along with try block. It is an optional block. The purpose is to close any opened connections within the program for security.

Post your comments here:

Your comments will be displayed after verification.