R

Ram Sharma • 193.86K Points
Coach

Q. What is a comparator in Java?

  • (A) Interface to compare integer
  • (B) Comparison method for lists
  • (C) Interface to compare two objects in java
  • (D) All of these
  • Correct Answer - Option(C)
  • Views: 276
  • Filed under category JAVA

Explanation by: Team MCQ Buddy
Java Comparator interface is used to order the objects of a user-defined class.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.

Related MCQs on JAVA

Q. What will be the output of the following Java program? class recursion { int fact(int n) { int result; if (n == 1) return 1; result = fact(n - 1) * n; return result; } } class Output { public static void main(String args[]) { recursion obj = new recursion() ; System.out.print(obj.fact(6)); } }

Q. JDBC RowSet is the wrapper of ResultSet,It holds tabular data like ResultSet but it iseasy and flexible to use.

Q. The String method compareTo() returns

Q. What is the result of the following code snippet? interface MyInterface { void myMethod(); } public class MyClass implements MyInterface { public void myMethod() { System.out.println("Implementation"); } public static void main(String[] args) { MyInterface obj = new MyClass(); obj.myMethod(); } }

Q. Which of these class provides various types of rounding functions?

Q. Which is used as an internal buffer and adds more efficiency than to write data directly into a stream. So, as to makes the performance fast?

Q. Which of the following statements about abstract methods/classes in JAVA is true?

Q. Which is a technique in Java in which a class can have any number of constructors that differ in parameter lists?

Q. What is BigDecimal.ONE?

Q. What will be the output of the following Java code? class Output { public static void main(String args[]) { byte a[] = { 65, 66, 67, 68, 69, 70 }; byte b[] = { 71, 72, 73, 74, 75, 76 }; System.arraycopy(a, 1, b, 3, 0); System.out.print(new String(a) + " " + new String(b)); } }

Learn All JAVA MCQs


Question analytics