What is the comparable interface, JAVA Programming

Assignment Help:

What is the Comparable interface?

Comparable interface is used to sort arrays and collections of objects using collections.sort() and java.utils. Objects of the class implementing Comparable interface can be ordered. All classes implementing Comparable interface should implement the compareTo() method which has the return type as an integer. Signature of compareTo() method is as below:

int i = object1.compareTo(object2)

  • If object1 < object2: The value of i returned will be negative.
  • If object1 > object2: The value of i returned will be positive.
  • If object1 = object2: The value of i returned will be zero.

 


Related Discussions:- What is the comparable interface

I want selenium based test automation for java, I want Selenium Based Test ...

I want Selenium Based Test Automation for Java Based Web Application Project Description: I want some test cases to be automated to login to UI which is Java based web applic

Read data from usb logs in windows, I want somebody to help me to create a ...

I want somebody to help me to create a program in java that helps me to read data from usb logs in windows Project Description: I want a java program that helps me to detect

Explain different way of using thread, Explain different way of using threa...

Explain different way of using thread? The thread could be executed by using runnable interface or by inheriting from the Thread class. The former is more advantageous, 'cau

Development build to production server tomcat, Move development build to pr...

Move development build to production server tomcat Project Description: Move our development build and integrate with MYSQL database, to our production vps. The software i

What should be public and private, What should be public? What should be pr...

What should be public? What should be private? As a rule of thumb: Classes are public. Fields are private. Constructors are public. Getter and setter methods

Constractar, Create a class HourlyWorker mind: particularHourlyWorker emplo...

Create a class HourlyWorker mind: particularHourlyWorker employee. • Declare two data members named wage and hours of double type with private access. • Implement a parameterized c

Explain pop, SMTP (Simple Mail Transfer Protocol) permits two mail servers ...

SMTP (Simple Mail Transfer Protocol) permits two mail servers to communicate using a easy language, and gives a step-by-step protocol for exchanging information. SMTP delivers m

Develop a client-server student record application, Develop a Client/Server...

Develop a Client/Server (MySQL) student record application Project Description: I need a client/server application with a MySQL backend database. The prototype could interfac

Implement design in the java programming language, Implement your design in...

Implement your design in the Java programming language. Your main program file must be called MIPSim.java. Your simulator should implement the MIPS instruction set with the rest

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd