in Technology by

Which method of the Class.class is used to determine the name of a class represented by the class object as a String?

a) getClass()

b) intern()

c) getName()

d) toString()

🔗Reference: stackoverflow.com

🔗Source: Java Interview Questions and Answers

1 Answer

0 votes
by

Answer: (c) getName()

Explanation: The getName() method of the Class class returns the name (as String) of the entity (class, interface) represented by this Class object. It is a non-static method, and available in the java.lang package.

The getClass() method of the Object class returns the runtime class of this object. The intern() and toString() methods are of String class.

Hence, the correct answer is option (c).

Related questions

0 votes
    Which of this method of class String is used to obtain a length of String object? (a) get() (b ... programming questions and answers pdf, java interview questions for beginners...
asked Oct 25, 2021 in Education by JackTerrance
0 votes
    Which of these method of class String is used to extract a single character from a String object? (a ... questions and answers pdf, java interview questions for beginners...
asked Oct 25, 2021 in Education by JackTerrance
0 votes
    Which of this method of class String is used to extract a substring from a String object? (a) ... programming questions and answers pdf, java interview questions for beginners...
asked Oct 25, 2021 in Education by JackTerrance
0 votes
    A ___________________ is an explicit numeric, character, string or Boolean value not represented by an identifier ... in section Query Processing Techniques of Database Management...
asked Oct 10, 2021 in Education by JackTerrance
0 votes
    Which of the following is a method having same name as that of it's class? (a) finalize (b) ... java programming questions and answers pdf, java interview questions for beginners...
asked Oct 26, 2021 in Education by JackTerrance
0 votes
    Which of the following is a method having same name as that of its class? (a) finalize (b) delete ... programming questions and answers pdf, java interview questions for beginners...
asked Oct 26, 2021 in Education by JackTerrance
0 votes
    Which of these is a class which uses String as a key to store the value in object? (a) Array (b) ... The Collections Framework of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    Which of these is a class which uses String as a key to store the value in object? (a) Array ... java programming questions and answers pdf, java interview questions for beginners...
asked Oct 25, 2021 in Education by JackTerrance
0 votes
    Name the predefined macro which be used to determine whether your compiler is ANSI standard or not?...
asked Nov 9, 2020 in Technology by JackTerrance
0 votes
    Which of these methods of class String is used to check whether a given object starts with a particular ... questions and answers pdf, java interview questions for beginners...
asked Oct 25, 2021 in Education by JackTerrance
0 votes
    Which of these methods of class StringBuffer is used to extract a substring from a String object? (a) ... questions and answers pdf, java interview questions for beginners...
asked Oct 25, 2021 in Education by JackTerrance
0 votes
    Which of these method of String class is used to obtain character at specified index? (a) char() ( ... programming questions and answers pdf, java interview questions for beginners...
asked Oct 26, 2021 in Education by JackTerrance
0 votes
    Which of these method of String class can be used to test to strings for equality? (a) isequal() ... programming questions and answers pdf, java interview questions for beginners...
asked Oct 26, 2021 in Education by JackTerrance
0 votes
    Which of these method of class String is used to compare two String objects for their equality? (a) ... questions and answers pdf, java interview questions for beginners...
asked Oct 25, 2021 in Education by JackTerrance
0 votes
    Which of these method of class String is used to remove leading and trailing whitespaces? (a) startsWith() ... questions and answers pdf, java interview questions for beginners...
asked Oct 25, 2021 in Education by JackTerrance
...