Object & Classes
- What is the output of this program?
class N
{
int K;
int L;
N()
{
K = 1;
L = 2;
}
}
public class Result
{
public static void main(String args[])
{
N object = new N();
System.out.print(object.toString());
}
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
toString() is method of class Object, since it is superclass of every class, every object has this method. toString() returns the string associated with the calling object.
- Which of these classes encapsulate runtime state of an object?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
Class
- Which of these methods returns the class of an object?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
getClass()
- Which of these is a process of converting a simple data type into a class?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
type wrapping
- Which of these classes is not included in java.lang?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
Array class is a member of java.util.