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 1 of 3.

Anand said:   1 decade ago
What is a class type? Any example?

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'.

Raja said:   1 decade ago
interface interface name
{
....
}

Gaurav said:   1 decade ago
Anyone please tell the functionality of the keyword interface i am new to java....

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.

Lemky said:   1 decade ago
Float comes under the keywords list in Java. In this question why only interface is the answer ?

Harry said:   1 decade ago
@Lemky.

float is keyword not Float.

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'.

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

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.


Post your comments here:

Your comments will be displayed after verification.