Java Programming - Language Fundamentals - Discussion
Discussion Forum : Language Fundamentals - General Questions (Q.No. 5)
5.
Which is a valid keyword in java?
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 1 of 3.
Ramzan Ali said:
4 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.
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.
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'.
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'.
San said:
7 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.
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.
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.
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.
Milanvachhani.blogspot.com said:
1 decade ago
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.
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.
This Float class is provided by The java itself then how Float is not keyword.
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?
Keyword and classtype are different right?
Sundar said:
1 decade ago
public class Car
{
...
}
Car c = new Car();
Explanation:
'Car' is a class type.
'c' is an object of type 'Car'.
{
...
}
Car c = new Car();
Explanation:
'Car' is a class type.
'c' is an object of type 'Car'.
Lemky said:
1 decade ago
Float comes under the keywords list in Java. In this question why only interface is the answer ?
Gaurav said:
1 decade ago
Anyone please tell the functionality of the keyword interface i am new to java....
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers