Object & Classes
- 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.
- What is the output of this program?
class N
{
int p;
double q;
}
class M extends N
{
int r;
}
public class Output
{
public static void main(String args[])
{
N p = new N();
M q = new M();
Class object;
object = p.getClass();
System.out.print(object.getName());
}
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
getClass() is used to obtain the class of an object, here ‘p’ is an object of class ‘N’. hence a.getClass() returns ‘N’ which is stored in class Class object object.
- Which of these class defines how the classes are loaded?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
ClassLoader
- Which of these keywords cannot be used for a class which has been declared final?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
A abstract class is incomplete by itself and relies upon its subclasses to provide complete implementation. If we declare a class final then no class can inherit that class, an abstract class needs its subclasses hence both final and abstract cannot be used for a same class.