in Education by
Which of these is an correct way of defining generic class? (a) class name(T1, T2, …, Tn) { /* … */ } (b) class name { /* … */ } (c) class name[T1, T2, …, Tn] { /* … */ } (d) class name{T1, T2, …, Tn} { /* … */ } This question was posed to me during an interview for a job. Asked question is from Type Interface in section Interfaces & Packages of Java Select the correct answer from above options JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
The correct choice is (b) class name { /* … */ } The best I can explain: The type parameter section, delimited by angle brackets (<>), follows the class name. It specifies the type parameters (also called type variables) T1, T2, …, and Tn.

Related questions

0 votes
    Which of these is an correct way of defining generic method? (a) name(T1, T2, , Tn) { /* ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 24, 2021 in Education by JackTerrance
0 votes
    Which of the following is the correct way of implementing an interface salary by class manager? (a) class ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 24, 2021 in Education by JackTerrance
0 votes
0 votes
    Which of these types cannot be used to initiate a generic type? (a) Integer class (b) Float class ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 24, 2021 in Education by JackTerrance
0 votes
    Which of the following is the correct way of importing an entire package pkg'? (a) import pkg. ( ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 24, 2021 in Education by JackTerrance
0 votes
    What are generic methods? (a) Generic methods are the methods defined in a generic class (b) Generic ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 24, 2021 in Education by JackTerrance
0 votes
    Which of these method of Array class is used sort an array or its subset? (a) binarysort() (b) ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 25, 2021 in Education by JackTerrance
0 votes
0 votes
0 votes
    Which of these class is related to all the exceptions that can be caught by using catch? (a) ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 25, 2021 in Education by JackTerrance
...