Java Programming - Language Fundamentals - Discussion

Discussion Forum : Language Fundamentals - General Questions (Q.No. 5)
5.
Which is a valid keyword in java?
interface
string
Float
unsigned
Answer: Option
Explanation:

interface is a valid keyword.

Option B is wrong because although "String" is a class type in Java, "string" is not a keyword.

Option C is wrong because "Float" is a class type. The keyword for the Java primitive is float.

Option D is wrong because "unsigned" is a keyword in C/C++ but not in Java.

Discussion:
25 comments Page 1 of 3.

Jaya surya said:   11 months ago
String is an java data type and immutable in nature.

Ramzan Ali said:   3 years ago
@Kote.

Final keyword is used for variable, method, and class for restrictions purposes.

1. When we declare any variable as final then we can not change the value of that variable.
2. If we declare any method as a final then we can not override that method.
3. If we declare a class as a final then we can not inherit that class.

Harsh thakkar said:   5 years ago
Float is also valid because it is wrapper class.

Harsh thakkar said:   5 years ago
Float is also valid because it is wrapper class.

San said:   6 years ago
@Kote.

The final keyword can be used for both classes & methods.
A final class cannot be extended.
A final method cannot be overridden.
Math class, StringBuilder, StringBuffer are examples for final classes.
Constants are final.

Palaniarjun said:   6 years ago
String is not a key word, String is one of the predefined class in java.

Brandon ceasar said:   7 years ago
@Vijaya.

About 49 keywords.
(1)

Kote said:   8 years ago
Can you explain about final keyword.

Vijaya said:   8 years ago
How many keywords are there in Java programming language?

Saurabh said:   9 years ago
String is a keyword.


Post your comments here:

Your comments will be displayed after verification.