---
title: "What is the difference between Comparable and Comparator?"  
description: "What is the difference between Comparable and Comparator?"  
author: "Anonymous User"  
published: 2015-05-13  
updated: 2020-09-20  
canonical: https://www.mindstick.com/interview/2521/what-is-the-difference-between-comparable-and-comparator  
category: "java"  
tags: ["java", "collection"]  
reading_time: 1 minute  

---

# What is the difference between Comparable and Comparator?

**Comparable** 1) Comparable provides only one sort of sequence. 2) It provides one method named compareTo(). 3) It is found in java.lang package. 4) If we implement Comparable interface, actual class is modified. \
**Comparator**1) Comparator provides multiple sort of sequences.2) It provides one method named compare().3) it is found in java.util package.4) Actual class is not modified.

## Answers

### Answer by Anonymous User

**Comparable** 1) Comparable provides only one sort of sequence. 2) It provides one method named compareTo(). 3) It is found in java.lang package. 4) If we implement Comparable interface, actual class is modified. \
**Comparator**1) Comparator provides multiple sort of sequences.2) It provides one method named compare().3) it is found in java.util package.4) Actual class is not modified.


---

Original Source: https://www.mindstick.com/interview/2521/what-is-the-difference-between-comparable-and-comparator

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
