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.

Jeevanantham said:   3 months ago
Goto keyword is used in C language also, then how do say that it is only in Java language?

Anyone please explain to me.

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).

Pavithra said:   3 years ago
In Java, we use the goto keyword when we write "labelled break " to break for loops.

Rakesh said:   5 years ago
In java there is no "goto" statement. Then how is the option B is correct.

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.

Vipul said:   6 years ago
Goto is a keyword in java and c/c++. So how it is java only keyword?

Naseem said:   7 years ago
Wrong, "goto" is not a java keyword.

Alok Raj Singh said:   7 years ago
But goto is also use in C Language.

Mukesh said:   7 years ago
c++ use goto as well. So how could option (b) is correct?

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

Post your comments here:

Your comments will be displayed after verification.