Java Programming - Language Fundamentals - Discussion

Discussion Forum : Language Fundamentals - General Questions (Q.No. 2)
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
Explanation:

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.

Discussion:
64 comments Page 2 of 7.

Indrajeet Singh said:   9 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
(1)

Sum said:   1 decade ago
Include is not a keyword in C. It is not in the list of words of 32 keywords of C.

Premchand said:   1 decade ago
Java has goto keyword but not in use.

Veerapaga srinivasulu said:   1 decade ago
Yes goto is Java keyword but not use.

Kirankumar said:   1 decade ago
Sir goto is a keyword of C not keyword of Java right (or) wrong?

Deep Vakharia said:   1 decade 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.

Vishnu said:   9 years ago
When we use "volatile" and "transient" in Java?

Satya said:   1 decade ago
Can you give explanation about "program driven languages" and "event driven languages"?

Vishesh said:   1 decade ago
None of the option is correct. Given answer B having goto is keyword of both Java and C.

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.


Post your comments here:

Your comments will be displayed after verification.