Java Programming - Language Fundamentals - Discussion

Discussion :: Language Fundamentals - General Questions (Q.No.5)


Which is a valid keyword in java?

[A]. interface
[B]. string
[C]. Float
[D]. unsigned

Answer: Option A


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.

Anand said: (Nov 18, 2010)  
What is a class type? Any example?

Sundar said: (Nov 18, 2010)  
public class Car

Car c = new Car();


'Car' is a class type.

'c' is an object of type 'Car'.

Raja said: (Sep 4, 2011)  
interface interface name

Gaurav said: (Feb 1, 2012)  
Anyone please tell the functionality of the keyword interface i am new to java....

Milanvachhani.Blogspot.Com said: (Feb 2, 2012)  
Interface is one type of class that do not have method implementation. It contains prototype of methods and variables. Variable of interface are final and static by default. You have to implement interface.

Lemky said: (Mar 5, 2012)  
Float comes under the keywords list in Java. In this question why only interface is the answer ?

Harry said: (Jun 19, 2012)  

float is keyword not Float.

Pinky said: (Jul 14, 2012)  
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'.

Raghu said: (Mar 20, 2013)  
Difference between class and interface?

Sathish Kumar R said: (Jul 20, 2013)  
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.

Panchi said: (Sep 21, 2013)  
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.

Alex said: (Oct 25, 2013)  
Why interface calling valid keyword?

Jodha said: (Mar 28, 2014)  
@Pinky said interface is a type of class. So how can interface be a valid keyword?

Keyword and classtype are different right?

Bala said: (Jan 4, 2015)  
Why unsigned not used in java?

Rajat said: (Jan 23, 2015)  
Why string is a class type if I said it is Java type?

Saurabh said: (Feb 1, 2015)  
String is a keyword.

Vijaya said: (Jul 2, 2016)  
How many keywords are there in Java programming language?

Kote said: (Jul 2, 2016)  
Can you explain about final keyword.

Brandon Ceasar said: (Oct 15, 2017)  

About 49 keywords.

Palaniarjun said: (Feb 16, 2018)  
String is not a key word, String is one of the predefined class in java.

San said: (Nov 20, 2018)  

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.

Harsh Thakkar said: (Aug 10, 2019)  
Float is also valid because it is wrapper class.

Harsh Thakkar said: (Aug 10, 2019)  
Float is also valid because it is wrapper class.

Ramzan Ali said: (Apr 24, 2021)  

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.

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.