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:
26 comments Page 2 of 3.

Saurabh said:   1 decade ago
String is a keyword.
(1)

Rajat said:   1 decade ago
Why string is a class type if I said it is Java type?

Bala said:   1 decade ago
Why unsigned not used in java?

Jodha said:   1 decade ago
@Pinky said interface is a type of class. So how can interface be a valid keyword?

Keyword and classtype are different right?

Alex said:   1 decade ago
Why interface calling valid keyword?
(1)

Panchi said:   1 decade ago
Keywords are the reserve words and Float is the wrapper class for float type.

This Float class is provided by The java itself then how Float is not keyword.

Sathish Kumar R said:   1 decade ago
Interface is a java type, it contains only abstract methods.

All interface methods by default abstract, public, non static. All interface variables by default final and static.

We can not create an instance of interface.

Raghu said:   1 decade ago
Difference between class and interface?

Pinky said:   1 decade ago
Interface is a type of class which have no body implementation.

It can be implemented to any user defined class using 'implements' and the methods declared in the interface are implemented in the class using an access specifier 'public'.

Harry said:   1 decade ago
@Lemky.

float is keyword not Float.


Post your comments here:

Your comments will be displayed after verification.