• Teaching
    • Montessori Teacher Training 🔥
    • Yoga Teacher Training
  • Coding
    • Full Stack Development Course
    • Data Science Course
    • Python Programming Course
    • Software Testing Course
    • Architecting on AWS
  • Commerce
    • PwC Edge : Strategic Accounting and Finance Programme
    • ACCA Course
    • SAP Fico Course
    • Practical Accounting Course
    • SAP MM Course
    • HR Management Course in Kerala
  • Technical
    • Structural Design Course
    • Embedded Systems Software Engineering in Kerala
    • MEP Course
    • MEP QS Course
    • BIM Training Course
    • Quantity Survey Course
  • Finacademy
    • Forex Trading Course
    • Stock Market Course
    • Mutual Funds Course in Kerala
  • Digital Marketing
    • Digital Marketing Course
    • Performance Marketing Course
  • Language Learning
    • Spoken English Course
    • German Language Course
    • IELTS Exam Coaching
  • Exam Preparation
    • Kerala PSC Coaching
    • Kerala PSC LGS Coaching
    • KAS Coaching
    • Kerala PSC LDC Coaching
    • Kerala PSC LSGS Coaching
    • KPSC Industries Extension Officer Coaching
    • KPSC Technical Mechanical Coaching
    • KPSC Technical Electrical Coaching
    • Kerala PSC Technical Exam Preparation
    • KPSC Technical Civil Coaching
    • SBI PO Coaching
    • IBPS Clerk Coaching
    • IBPS PO Coaching
    • IBPS SO Coaching
    • Bank Exam Coaching
    • Lecturer in DIET Course
    • Kpsc HSA Coaching
    • KPSC LP UP Assistant Coaching
    • EMRS Coaching
    • KTET Coaching
    • SSC Coaching
    • SSC JE Coaching
    • SSC CGL Coaching
    • SSC CHSL Coaching
    • SSC MTS Coaching
    • UPSC Coaching
  • Health Care
    • DHA Course
    • OET Coaching
  • Other Exams
    • GATE Coaching
    • CAT Coaching
    • MAT Online Coaching
    • KMAT Online Coaching
Entri Blog
No Result
View All Result
Sunday, May 18, 2025
  • Kerala PSC
    • Kerala PSC General
      • Kerala PSC Exams
      • KAS Exam
      • Kerala PSC VEO Notification
      • Kerala Police SI
      • Kerala PSC LDC Notification
      • Kerala PSC Village Field Assistant Notification
      • Kerala PSC LD Typist Notification
      • Kerala PSC Food Safety Officer
      • Kerala PSC Excise Inspector Notification
      • Kerala PSC BDO Notification
      • Kerala PSC CPO Notification
      • Kerala PSC LGS Notification
      • Fire and Rescue Officer
      • Women Fire and Rescue Officer
    • Kerala PSC Teaching
      • Kerala PSC HSA
      • Kerala PSC HSST
      • KTET
      • LP/UP Assistant
      • KVS
      • Railway Teacher
    • Kerala PSC Technical
      • LSGD AE
      • Draftsman/Overseer
      • IEO
      • ATP
      • Polytechnic Lecturer
      • AE Electronics
      • Assistant Engineer
  • Banking
    • IBPS PO Notification
    • IBPS Clerk Notification
    • SBI PO Notification
    • SBI Clerk Notification
    • SBI SO Notification
    • SBI Apprentice Notification
    • Canara Bank PO Notification
    • Indian Bank PO Notification
    • RBI Assistant Notification
    • RBI Office Attendant Notification
    • IBPS RRB Notification
    • IBPS RRB Office Assistant Notification
  • Skilling
    • Coding
    • Spoken English
    • Stock Market
      • Share Market Today News
      • Share Market Analysis
    • Digital Marketing
    • Accounting Course
    • SAP
    • OET
    • German
    • IELTS
    • Quantity Survey
    • MEP
    • Structural Design
    • Montessori
    • Yoga Teaching
    • Oil and Gas
  • Courses
    • Data Science Course
      • Data Science Malayalam
      • Data Science Course in Tamil
      • Data Science Course in Telugu
      • Data Science Training in Kochi
      • Data Science Training in Trivandrum
      • Data Science Course in Calicut
      • Data Science Training in Thrissur
    • Data Analytics Course
      • Data Analytics Course in Malayalam
      • Data Analytics Course in Tamil
      • Data Analytics Course in Telugu
    • Technical Upskilling
      • Quantity Surveying Course
      • Structural Design Course
      • BIM Course in Kerala
      • MEP Course
      • Embedded System Course
      • MEP Quantity Surveying Course
      • MEP Course in Kochi
      • Quantity Surveyor Course in Tamil
      • Quantity Surveying Course in Telugu
      • Quantity Surveyor Course in Hyderabad
      • Quantity Surveying Course in Chennai
      • MEP Design Course in Kerala
      • HVAC Course
      • Steel Structure Design Course
      • RCC Design Course
    • Full Stack Developer Course
      • Full Stack Development Malayalam
      • Full Stack Development Hindi
      • Full Stack Development Tamil
      • Full Stack Development Telugu
      • Full Stack Development Kannada
    • Stock Market Course
      • Stock Market Course in Malayalam
      • Stock Market Course in Tamil
      • Stock Market Course in Kannada
      • Options Trading Course
    • Mutual Funds Course
    • Forex Trading Course
    • Spoken English Course
      • Spoken English Course in Malayalam
      • Spoken English Course in Hindi
      • Spoken English Course in Telugu
      • Spoken English Course in Tamil
      • Spoken English Course in Kannada
    • Python Programming Course
    • Software Testing Course
      • Software Testing Course in Malayalam
      • Software Testing Course in Tamil
      • Software Testing Course in Telugu
    • AWS Solutions Architect Associate Course
    • PwC Edge : Strategic Accounting and Finance Programme
    • Practical Accounting Course
      • Accounting Course in Malayalam
      • Accounting Course in Tamil
      • Tally Course
      • Taxation Course
      • UAE Accounting
      • GST Course
      • Zoho Books Training
      • GST Practitioner Course in Kerala
      • GCC VAT Course
    • ACCA Training Online
      • ACCA Course in Kerala
    • SAP Training Courses
      • SAP FICO Course
      • SAP MM Course
      • SAP SD Training
      • SAP FICO Course in Tamil
      • SAP MM Course in Tamil
    • HR Management Course
    • Performance Marketing Course
    • Mern Stack Developer Course
      • Full Stack Developer Course in Kochi
      • Full Stack Developer Course in Trivandrum
      • Full Stack Developer Course in Calicut
      • Full Stack Developer Course in Pune
      • Full Stack Developer Course in Bangalore
      • Full Stack Developer Course in Hyderabad
      • Full Stack Developer Course in Chennai
      • Full Stack Developer Course in Indore
      • Full Stack Developer Course in Jaipur
      • Full Stack Developer Course in Coimbatore
    • Digital Marketing Training
      • Digital Marketing Course in Kochi
      • Digital Marketing Course in Trivandrum
      • Digital Marketing Course in Calicut
      • Digital Marketing Course in Kollam
      • Digital Marketing Course in Thrissur
      • Digital Marketing Course in Kottayam
      • Digital Marketing Course in Kannur
    • Montessori Teacher Training
      • Montessori Teacher Training in Calicut
      • Montessori Teacher Training in Kochi, Ernakulam
      • Montessori Teacher Training in Trivandrum
      • Montessori Teacher Training in Kollam
      • Montessori Teacher Training in Malayalam
      • Montessori Teacher Training in Kannada
    • Other Courses
      • German Language Course
      • OET Coaching
        • OET for Pharmacist
        • OET for Nurses
      • DHA Course
      • MOH Exam Coaching
      • Nurses Recruitment Abroad
      • FMGE Coaching
      • ChatGPT Course
      • Forex Trading Course
      • Yoga Teacher Training Course
      • Diploma in Early Childhood Care and Education
      • Business Administration & Hospital Management Course
      • Hospital and Healthcare Administration
      • AI for Teachers Course
  • Others
    • Railway
      • RRB Technician Notification
      • RRB JE Notification
      • RRB ALP Notification
      • RRB NTPC Notification
      • RRB RPF Notification
      • RRB RPF SI Notification
      • RRB RPF Constable Notification
      • RRB Group D Notification
      • RRB RPSF SI Notification
      • RRB SSE Notification
    • SSC
      • SSC CPO Notification
      • SSC MTS Notification
      • SSC CGL Notification
      • SSC CHSL Notification
      • SSC GD Constable Notification
      • SSC Stenographer Notification
      • SSC JE Notification
      • SSC CAPF Notification
      • SSC JHT Notification
      • Delhi Police Constable Notification
      • Delhi Police SI Notification
    • GATE
    • MAT
    • KMAT
      • KMAT Kerala 2024
    • TET
      • APTET
      • CTET
      • DSSSB
      • Karnataka TET
      • Kerala TET
        • KTET Notification
      • KVS
      • MPTET
      • SUPER TET
      • TNTET
      • TSTET
      • UPTET
    • UPSC
      • UPSC CAPF Notification
      • UPSC CDS Notification
      • UPSC NDA Notification
      • UPSC Civil service Notification
  • Free Learn
    • Free Courses
      • Free Coding Courses
        • C Langauge Courses
        • Free Data Science Courses
        • Free Full Stack Developer Courses
        • Free Python Programming Courses
      • Free Accounting Courses
      • Free Digital Marketing Courses
        • Free SEO Courses
        • Web Development for Marketers
      • Engineering Upskilling Courses
      • Free Hospital Administration Courses
      • Free OET Training
      • Free SAP Courses
      • Free Teachers Training Courses
      • Free Trading Courses
        • Free Stock Market Courses in Malayalam
        • Free Options Trading Course Malayalam
        • Free Forex Trading Courses Malayalam
        • Free Personal Finance Courses Malayalam
    • Question Answer
    • Aptitude Questions
    • Webinars
  • Test Prep
    • Kerala PSC Coaching
      • KPSC Degree Level Exam Preparation
      • Kerala PSC 12th Level Exam Preparation
      • Kerala PSC 10th Level Exam Preparation
      • KAS Coaching
      • Kerala PSC LDC Coaching
      • Kerala PSC LD Typist Coaching
      • Kerala PSC Fireman Coaching
      • KSFE Assistant Exam Preparation
      • Secretariat Office Attendant Coaching
      • Secretariat Assistant Coaching
      • Kerala PSC SI Exam Coaching
      • Khadi Board LDC Exam Preparation
      • Devaswom Board LDC Coaching
      • University LGS Exam Preparation
      • University Assistant Exam Coaching
      • KPSC Scientific Officer Exam Coaching
      • KPSC Probation Officer Grade II
      • KPSC Food Safety Officer Coaching
      • KWA Sanitary Chemist Coaching
      • KPSC Diary Farm Instructor Exam Coaching
      • Kerala PSC KWA Lab Assistant Exam Coaching
      • Kerala PSC ICDS Supervisor Exam Coaching
      • KPSC Finger Print Searcher Coaching
      • Kerala PSC Welfare Officer Gr. II Exam Coaching
      • KPSC Assistant Dental Surgeon Coaching
    • KPSC Teaching Exams
      • HSA Exam Preparation
      • KPSC HSA Social Science Coaching
      • KPSC HSA Physical Science Coaching
      • KPSC HSA English Coaching
      • KPSC Junior Language Teacher Hindi
      • KTET Coaching
      • SET Coaching
      • LP/UP Assistant Exam Coaching
      • HSST Exam Preparation
      • HSST Commerce Exam Coaching
      • Kerala PSC Lecturer in Diet Coaching
      • KVS PGT/TGT Coaching
    • Kerala PSC Technical Exams Coaching
      • Assistant Engineer Electrical Exam Coaching
      • Assistant Engineer Electronics Coaching
      • Assistant Engineer Mechanical Coaching
      • Kerala PSC Industries Extension Officer Coaching
      • KPSC LSGD AE Exam Coaching
      • KPSC Civil Engineering Exam Coaching
      • KPSC Mechanical Engineering Exam Coaching
      • KPSC Electrical Engineering Exam Coaching
      • KPSC Electronics Engineering Exam Coaching
      • KPSC Technical Computer Science Coaching
      • KPSC Tradesman Turning Coaching
      • Kerala PSC Overseer Exam Coaching
      • KPSC Assistant Town Planner Coaching
      • Lecturer in Polytechnic Electronics Coaching
    • Teaching Exams Coaching
      • CSIR NET Exam Coaching
      • EMRS Coaching
      • CTET Exam Online Coaching
    • IELTS Training Online
    • Bank Exam Coaching Online
      • SEBI Grade A Coaching
      • IBPS SO Online Coaching
      • IBPSC PO Online Coaching
      • IBPSC Clerk Online Coaching
      • SBI PO Coaching
      • SBI Clerk Online Coaching
      • SBI Apprentice Class
      • SBI SO Online Coaching
      • RBI Grade B Coaching
      • RBI Assistant Coaching
      • CSEB Exam Coaching
      • IBPS RRB Coaching
      • IBPS RRB PO Coaching
      • Canara Bank Po Exam Coaching
      • Kerala Gramin Bank Coaching
      • Kerala Bank Exam Coaching
        • Kerala Bank Clerk Exam Coaching
        • Kerala Bank Office Attendant Exam Coaching
        • Kerala Bank Assistant Manager Exam Coaching
      • JCI Exam Coaching
      • NABARD Grade A Coaching
      • LIC AAO Coaching Online
    • UPSC Online Coaching
      • UPSC CAPF Online Coaching
    • SSC Online Coaching
      • SSC JE Online Coaching
      • SSC CGL Coaching
      • SSC CGL AAO Coaching
      • SSC CGL CBI Inspector Coaching
      • SSC CHSL Coaching
      • SSC MTS Coaching
      • SSC Stenographer Coaching
      • SSC GD Online Coaching
    • RRB Exams Coaching
      • RRB RPF Exam Coaching
      • RRB NTPC Exam Coaching
      • RRB JE Online Coaching
      • RRB JE Electronics Coaching
      • RRB ALP Exam Coaching
      • RRB Technician Exam Coaching
    • CAT Online Coaching
    • CMAT Online Coaching
    • XAT Exam Coaching
    • GATE Online Coaching
      • GATE CE Online Coaching
      • GATE ME Online Coaching
      • GATE EE Online Coaching
    • NMAT Exam Coaching
    • AAI ATC Jr Executive Coaching
    • Cochin Shipyard Executive Trainee Coaching
    • BEL Probationary Engineer Coaching
    • HPCL Junior Executive Coaching
Free Courses
Entri Blog
  • HTML Tutorial
  • DSA Tutorials
  • Tutorials in Hindi
    • HTML Tutorial for Beginners in Hindi
    • Python Tutorial for Beginners in Hindi
    • GIT and GITHUB Tutorial for Beginners in Hindi
  • Tutorials in Tamil
    • JavaScript Tutorial in Tamil
  • Tutorials in Telugu
    • HTML Tutorial For Beginners in Telugu
    • CSS Tutorial for Beginners in Telugu
    • Bootstrap Tutorial for Beginner in Telugu
  • Tutorials in Kannada
    • HTML Tutorial For Beginners in Kannada
entri exclusive offers entri exclusive offers
Home Articles

What is Comparable Interface in Java with Examples?

by Akhil M G
November 20, 2022
in Articles, Data Science and Machine Learning, Java Programming, React Native, Web and Android Development
What is Comparable Interface in Java with Examples?
Share on FacebookShare on WhatsAppShare on Telegram

Table of Contents

  • Super Set Sorting
  • Equals Is True?
  • Ordering by Size
  • Ordering by Name Length
  • Random Number Generator
  • Checkerboard Game Board
  • Bubble Sort
  • User’s Choice List
  • Password Validation
  • Online Shopping Cart

Having been designed and developed by Sun Microsystems, Java is one of the most used programming languages across the globe. It has two types of interfaces – the Comparable interface and the Comparator interface. Both of these interfaces provide the functionality of comparing objects that implement it with other objects implementing it; however, their usage differs slightly in terms of implementation and execution. Let’s take a look at these two interfaces in detail to understand what they are and how we can use them in our applications. The Comparable interface in Java ensures that one object can be compared to another object with respect to the natural ordering of its underlying type, represented by the < operator in Java. In this article, we will explore 10 key examples of Comparable interfaces in Java which will help you understand its concepts easily. The Comparable interface in Java basically compares the two objects by their values and then returns 0, 1 or -1 as the result of the comparison depending on whether the first object’s value is less than, equal to or greater than the second object’s value. The Comparable interface in Java makes sorting and comparing objects easier since you don’t have to rely on hard-coded values and can simply rely on the return values from methods that implement this interface. These methods can be called directly from an application without the need for subclassing classes or implementing new interfaces.Python and Machine Learning Rectangle

Super Set Sorting

In an example of a Comparable interface, you will see how two types of objects can be sorted together. Suppose we have class Alpha which has field alpha1 and Alpha 2 which has field alpha2. Now suppose we want both of these classes to be used as part of set sorting (lets say) then we will make one class Comparable (implemented) and another extends one. So now when ever we need to sort a comparator object, then it will make use of comparable class object and they will follow every thing defined inside Comparable interface. Sorting can take place on same data type or different data type. For example if we are sorting String with String then it will go by alphabetical order of string. If we are sorting Integer with Integer then it will go by numerical order. This is all possible because of comparable interface. In our case here we are comparing two Alpha objects so that they can be sorted easily. We have created compareTo() method and inside that compareTo() method we have compared alpha1 and alpha2 fields with each other based on some criteria which is not important for us here. This is how its done! In our above example, if any argument passed to compareTo() method is null than compareTo() method returns 0 instead of throwing NullPointerException . But there is no rule for user defined class to implement it like that. User defined class should throw NullPointerException if any argument passed to compareTo() method is null . This behavior is not mandatory but most programmers do implement it like that. The Comparable interface in Java allows you to compare two objects, such as two different string values or even two different Business Objects, and then get a result that indicates whether the two compared objects are ordered in the same way or not, or if they are ordered in reverse. This can be used to sort arrays of objects easily, but also to check whether one object is greater than the other in some way. Let’s find out how you can use this interface effectively in your Java projects!

Learn to code from industry experts! Enroll here

Equals Is True?

1: What is the default value of a boolean in Java?

2: What is the TreeSet Interface?

3: Which loop construct in Java best suits when the number of iterations is known?

4: What is the size of a byte variable?

5: Which of the following is thread safe?

    Fill out the form to see the results

    Ever wondered how much you really know? It's time to put your brain to the test!

    Equality is not a valid measure of sameness. Using String objects, you can have identical code that gives you three different answers based on how you look at things. For example, myString.equals(myString) will be true because myString and myString are equal (thanks to string interning), but myString == myString is false—because those two strings point to two separate instances of String. If someone asks if your program works for strings that aren’t equivalent, that’s where using equals() comes in handy; it compares your objects on an object-by-object basis rather than just trying to figure out if they’re pointing at the same place in memory. And as we’ve seen, equality doesn’t necessarily mean equivalence. In other words, these lines are all true: abc.equals(abc) abc.equals(ABC) abc.equals(ABCD) But if you use abcd.equals(abcd), it will return false! Why? Because while both strings contain the same characters in exactly the same order, each instance points to a different place in memory. Whether you’re an experienced developer or a newbie, it’s important to have at least some basic understanding of the Comparable interface in Java. If you don’t know how this useful tool works, then you could be missing out on some great functionality in your applications and projects. This article will provide an introduction to the Comparable interface in Java, along with several examples of how you can use it to improve your program’s performance and efficiency.

    Explore Free Coding Courses !

    Take your first step toward mastering in-demand skills, acing interviews, and securing top-tier jobs with Entri's free coding courses.

    👉 Explore Free Courses Now

    Ordering by Size

    Here is an example that lets you order books by size. When ordering an e-book, it might make sense to also list out its size in comparison with other books. To achieve that, you could create a Book class with a Size field, and use that when sorting books on your website. That way, if your users are ordering physical copies of books as well as e-books, they can still have their items listed by size. Note that you don’t need to know how to code at all for any of these examples—you just need to understand what’s going on. This isn’t meant to be used as instructions for writing code—rather, think of it as an explanation for what different lines mean so that you can follow along more easily. If nothing else, these examples should help clear up some confusion about comparable interfaces in Java! For example, does it really matter whether or not we include null values? The answer is no!

    Learn Coding in your Language! Enroll Here!

    Ordering by Name Length

    The Comparable interface contains two comparison methods you can use with strings, name().isOrderedBefore(String) and name().isOrderedAfter(String). Suppose you have a collection of names and want to sort them by length; you could use a comparable object as follows. Note that we needed both name() and compareTo() because using just one or another will not work correctly. The first element of c is Cecilia, so it should be ordered before all others. However, if we used only name(), then Catherina would come after Cecilia because they are equal under name(). But since Catherina comes after Cecilia alphabetically, it needs to come after her in our list too. So we need to call compareTo() on both elements. the java programming language allows for many types of user-defined classes. Among these are classes that model various kinds of numbers. This section provides an overview of how number classes work and some examples illustrating their usage. We’ll begin with an overview of how numerical values behave in Java, followed by details about primitive types (integers, floating-point numbers, etc.) Next we’ll look at reference types (objects), which represent numeric values within Java programs. We’ll conclude with a discussion about class Math and its role within the java library for working with numeric values. As programmers familiarize themselves more deeply with any programming language, they discover new ways to express program logic concisely and accurately.

    Random Number Generator

    In an earlier example, we wrote a program that generates random integers using raw random() method. We will now improve on that design by using a separate Random object. The advantages of doing so include better control over seed values and support for concurrent threads. A disadvantage is increased initial complexity but once it’s set up, its easier to use, especially if you are generating many random numbers or doing something with those numbers after they have been generated (such as statistics gathering or simulations). Code Sample 5-1 shows how to do just that. Just by looking at it, can you determine why it might be advantageous? Which class and method are executed concurrently? In general, what are some ways you could make your own program more thread safe? What would you need to consider? If these questions don’t jump out at you right away, take a moment to think about them before moving on. The answers may not come easily, but don’t worry—we’ll revisit them later in Part III when we talk about concurrency in detail.

    Learn Coding in your Language! Enroll Here!

    Explore Free Coding Courses !

    Take your first step toward mastering in-demand skills, acing interviews, and securing top-tier jobs with Entri's free coding courses.

    👉 Explore Free Courses Now

    Checkerboard Game Board

    This example shows how Comparable interface can be used while sorting numbers. The concept is simple. You have a checkerboard board with a defined number of rows and columns. Each cell is assigned a unique id, which helps us in sorting these cells based on their respective row and column position. To make it interesting, we’ll add logic for exchanging two cells (based on their ids) if they are equal. Note that each cell can only belong to one row or one column at any given time. If a cell changes its position from one row/column to another, it should take its new position’s unique id as its current identifier (or vice versa). We’ll start off by defining our class variables. The first thing we need to do is define a function that will assign an ID to each of our cells. In order to do so, we need a list of integers. For now, let’s just create an array with four integers: 0 , 1 , 2 , 3 . We can then use those values as keys when creating new Cell objects inside our main() method. Next up, let’s create an array called cells and assign it all zeros except for 0, which gets set to 1 . That way, when we loop through our array later on, every element other than 0 will automatically get set to zero because arrays are zero-indexed.

    Bubble Sort

    This sorting algorithm is considered inefficient, but it has its merits. Bubble sort works by comparing each pair of items. If one item is less than or equal to another, no bubble will be created; however, if one value is greater than another, a bubble is made with that pair inside. The bubbles are then sorted and moved up (or down) accordingly until they disappear into their appropriate bin. The algorithm moves as quickly as possible until it finishes without any swaps or other fancy operations to speed things up. Although bubble sort has its uses—and can even outperform some algorithms in certain situations—its lack of efficiency makes it a poor choice for many applications where time matters. For instance, bubble sort could be a good option for high school students learning about sorting techniques. The Comparable interface was introduced in Java SE 8 to allow the programmer to specify custom natural ordering relationship of objects in custom classes (or interfaces). Similar to how you can use the Comparator interface to define the sort order when sorting an array or list, you can use Comparable to define the sort order when using Collections API sorting methods such as Collections.sort() . To do so, first you need to implement the Comparable interface and then declare that your class supports comparisons in its API documentation.

    User’s Choice List

    Create a list of user’s choices with GUI, where each item has a corresponding option which can be selected. In case of an invalid entry, users can correct it and resubmit or proceed without correction. Show how your design is robust against null values from user inputs. Another challenge is implementing pagination for data sets that are too large to fit on one screen (such as playing a movie). Provide solution code that supports up and down keys (or buttons) on the keyboard while displaying current page number and total pages in UI. Make sure that your solution also handle cases when data set isn’t sorted properly using default sorting method (eg. alphabetical order), so that items are displayed in proper order. The key point here is to show you have thought about all possible use cases and have prepared for them by providing solutions. Remember, most interviewers aren’t looking at whether you got it right; they’re looking at whether you thought about all possible scenarios before coding anything! So don’t just jump into coding; think first! It’s better to take some time upfront thinking through various edge-cases than taking hours trying to debug something later on because you didn’t think about all possible use-cases during development!

    Learn to code from industry experts! Enroll here

    Password Validation

    When creating a password policy for your system, you may want to validate whether passwords meet certain requirements. For example, passwords should be at least eight characters long and should contain one letter and one number. If they don’t, they might get rejected. To implement such validation logic, you can write code that compares an object’s value with specific criteria by implementing Comparable interface. There are multiple overloads of compareTo() method available in Comparable interface which accepts parameters of type int , long , float , double , char & String . All these parameters except String take values as non-negative constants i.e., valid range or actual value instead of null references indicating not acceptable input value for given parameter.

    Online Shopping Cart

    The shopping cart application is a personal information manager (PIM) or an online shopping cart software that allows consumers to combine different items and checkout online at once. The functionality of a shopping cart can be compared with a physical shopping cart found in retail stores but has key differences. A physical store’s shopping carts are usually located near each of its cash registers, making it easy for customers to purchase items individually. Physical stores do not make it convenient for customers to go back and check out more products at a later time because they only have one physical cart available per register. Online, however, there are no barriers between visitors and their chosen products as they can add different items as many times as they want without having restrictions on inventory space. If you are interested to learn new coding skills, the Entri app will help you to acquire them very easily. Entri app is following a structural study plan so that the students can learn very easily. If you don’t have a coding background, it won’t be any problem. You can download the Entri app from the google play store and enroll in your favorite course.Python and Machine Learning Rectangle

    Share62SendShare

    Akhil M G

    Related Posts

    Budget vs Premium IELTS Coaching in Kerala Key Differences, Pricing & What You Really Get
    Articles

    Budget vs Premium IELTS Coaching in Kerala: Key Differences, Pricing & What You Really Get

    May 18, 2025
    IELTS Exam Centers in Kerala (2025) Test Locations, Facilities & Booking
    Articles

    IELTS Exam Centers in Kerala (2025): Test Locations, Facilities & Booking

    May 17, 2025
    Big 4 vs Mid-Sized Firms Where Should a Fresher Start
    Accounting

    Big 4 vs Mid-Sized Firms | Where Should a Fresher Start?

    May 18, 2025
    Next Post
    Artificial Intelligence and Machine Learning Technologies in Sports

    Artificial Intelligence and Machine Learning Technologies in Sports

    More to Explore

    1. Future Scope of Full Stack Developers
    2. Best Full Stack Developer Course with Placement
    3. Python Full Stack vs Java Full Stack Developers
    4. Top Trends in Full Stack Development Career
    5. Guide to Full Stack Web Development – Skills, Career Opportunities, Salary
    6. Full Stack Developer Salary for Freshers and Experienced
    7. Full Stack Developer Jobs and Career to Follow
    8. Full Stack JavaScript Development

    Free Tutorials For You

    1. SQL Tutorial for Beginners PDF
    2. Python Tutorial for Beginners in Hindi
    3. GIT and GITHUB Tutorial for Beginners in Hindi
    4. HTML Exercises to Practice
    5. JavaScript Tutorial in Tamil
    6. DSA Practice Series
    7. Microsoft Excel Malayalam Tutorial
    8. Learn Bootstrap in Tamil
    9. Introduction to CSS in Malayalam
    10. Introduction to JavaScript in Malayalam
    11. Java Programming Notes PDF
    12. Introduction to HTML in Malayalam

    Full Stack Training in Different Cities

    1. Full Stack Developer Course in Kochi
    2. Full Stack Developer Course in Trivandrum
    3. Full Stack Developer Course in Calicut
    4. Full Stack Developer Course in Pune
    5. Full Stack Developer Course in Bangalore
    6. Full Stack Developer Course in Hyderabad
    7. Full Stack Developer Course in Chennai
    8. Full Stack Developer Course in Coimbatore
    9. Full Stack Developer Course in Indore
    10. Full Stack Developer Course in Jaipur
    11. Full Stack Developer Course in Mumbai

    More to Learn

    1. Top C++ Interview Questions and Answers
    2. Top 100 C# Interview Questions and Answers
    3. Top 100 Angular Interview Questions and Answers
    4. Interview Questions and Answers for Web Development
    5. Career Options after Engineering

    Courses

    • Data Science Course
    • Full Stack Developer Course
    • Software Testing Course
    • Data Science Course in Malayalam
    • Full Stack Developer Course in Malayalam
    • Full Stack Developer Course in Hindi
    • Full Stack Developer Course in Tamil
    • Full Stack Developer Course in Telugu
    • Full Stack Developer Course in Kannada
    • Python Programming Course
    • Practical Accounting Course
    • Structural Design Course
    • Quantity Surveying Course
    • Embedded Systems Course in Kerala
    • BIM Course
    • MEP Course
    • MEP QS Course
    • Stock Market Course
    • Stock Market Course in Malayalam
    • Stock Market Course in Tamil
    • Stock Market Course in Kannada
    • Forex Trading Course
    • Mutual Funds Course
    • PwC Edge : Strategic Accounting and Finance Programme
    • SAP FICO Training
    • SAP MM Training
    • SAP SD Training
    • ACCA Online Course
    • HR Management Course

    Company

    • Become a teacher
    • Login to Entri Web

    Spoken English Courses

    • Spoken English Course
    • Spoken English Course in Malayalam
    • Spoken English Course in Hindi
    • Spoken English Course in Tamil
    • Spoken English Course in Telugu
    • Spoken English Course in Kannada
    • Spoken English Course for Housewives
    • Spoken English Course for Working Professionals
    • Spoken English Course for School Students
    • Spoken English Course for College Students
    • Spoken English Course for Job Seekers
    • AI Powered Spoken English Course

    Quick Links

    • Explore Free Courses
    • Aptitude Questions
    • Articles
    • Videos
    • Entri Daily Quiz Practice
    • Current Affairs & GK
    • News Capsule – eBook
    • Preparation Tips
    • Kerala PSC Gold
    • Entri Skilling
    • Kerala PSC

    Other Courses

    • OET Coaching Classes
    • DHA Course
    • Nurse Recruitment Abroad
    • Montessori Teachers Training
    • Performance Marketing Course
    • German Language Course
    • Yoga Teacher Training Course
    • Digital Marketing Course
    • Options Trading Course
    • German Language A1 Course
    • German Language A2 Course
    • German Language B1 Course
    • German Language B2 Course
    • Diploma in Early Childhood Care and Education
    • Hospital and Healthcare Administration
    • Business Administration & Hospital Management
    • Hospital and Healthcare Administration

    Popular Exam

    • IBPS Exam
    • SBI Exam
    • Railway RRB Exam
    • Kerala PSC
    • Tamil Nadu PSC
    • Telangana PSC
    • Andhra Pradesh PSC
    • MPPSC
    • UPPSC
    • Karnataka PSC
    • Staff Selection Commission Exam
    • GATE

    © 2023 Entri.app - Privacy Policy | Terms of Service

    No Result
    View All Result
    • Kerala PSC
      • Kerala PSC General
        • Kerala PSC Exams
        • KAS Exam
        • Kerala PSC VEO Notification
        • Kerala Police SI
        • Kerala PSC LDC Notification
        • Kerala PSC Village Field Assistant Notification
        • Kerala PSC LD Typist Notification
        • Kerala PSC Food Safety Officer
        • Kerala PSC Excise Inspector Notification
        • Kerala PSC BDO Notification
        • Kerala PSC CPO Notification
        • Kerala PSC LGS Notification
        • Fire and Rescue Officer
        • Women Fire and Rescue Officer
      • Kerala PSC Teaching
        • Kerala PSC HSA
        • Kerala PSC HSST
        • KTET
        • LP/UP Assistant
        • KVS
        • Railway Teacher
      • Kerala PSC Technical
        • LSGD AE
        • Draftsman/Overseer
        • IEO
        • ATP
        • Polytechnic Lecturer
        • AE Electronics
        • Assistant Engineer
    • Banking
      • IBPS PO Notification
      • IBPS Clerk Notification
      • SBI PO Notification
      • SBI Clerk Notification
      • SBI SO Notification
      • SBI Apprentice Notification
      • Canara Bank PO Notification
      • Indian Bank PO Notification
      • RBI Assistant Notification
      • RBI Office Attendant Notification
      • IBPS RRB Notification
      • IBPS RRB Office Assistant Notification
    • Skilling
      • Coding
      • Spoken English
      • Stock Market
        • Share Market Today News
        • Share Market Analysis
      • Digital Marketing
      • Accounting Course
      • SAP
      • OET
      • German
      • IELTS
      • Quantity Survey
      • MEP
      • Structural Design
      • Montessori
      • Yoga Teaching
      • Oil and Gas
    • Courses
      • Data Science Course
        • Data Science Malayalam
        • Data Science Course in Tamil
        • Data Science Course in Telugu
        • Data Science Training in Kochi
        • Data Science Training in Trivandrum
        • Data Science Course in Calicut
        • Data Science Training in Thrissur
      • Data Analytics Course
        • Data Analytics Course in Malayalam
        • Data Analytics Course in Tamil
        • Data Analytics Course in Telugu
      • Technical Upskilling
        • Quantity Surveying Course
        • Structural Design Course
        • BIM Course in Kerala
        • MEP Course
        • Embedded System Course
        • MEP Quantity Surveying Course
        • MEP Course in Kochi
        • Quantity Surveyor Course in Tamil
        • Quantity Surveying Course in Telugu
        • Quantity Surveyor Course in Hyderabad
        • Quantity Surveying Course in Chennai
        • MEP Design Course in Kerala
        • HVAC Course
        • Steel Structure Design Course
        • RCC Design Course
      • Full Stack Developer Course
        • Full Stack Development Malayalam
        • Full Stack Development Hindi
        • Full Stack Development Tamil
        • Full Stack Development Telugu
        • Full Stack Development Kannada
      • Stock Market Course
        • Stock Market Course in Malayalam
        • Stock Market Course in Tamil
        • Stock Market Course in Kannada
        • Options Trading Course
      • Mutual Funds Course
      • Forex Trading Course
      • Spoken English Course
        • Spoken English Course in Malayalam
        • Spoken English Course in Hindi
        • Spoken English Course in Telugu
        • Spoken English Course in Tamil
        • Spoken English Course in Kannada
      • Python Programming Course
      • Software Testing Course
        • Software Testing Course in Malayalam
        • Software Testing Course in Tamil
        • Software Testing Course in Telugu
      • AWS Solutions Architect Associate Course
      • PwC Edge : Strategic Accounting and Finance Programme
      • Practical Accounting Course
        • Accounting Course in Malayalam
        • Accounting Course in Tamil
        • Tally Course
        • Taxation Course
        • UAE Accounting
        • GST Course
        • Zoho Books Training
        • GST Practitioner Course in Kerala
        • GCC VAT Course
      • ACCA Training Online
        • ACCA Course in Kerala
      • SAP Training Courses
        • SAP FICO Course
        • SAP MM Course
        • SAP SD Training
        • SAP FICO Course in Tamil
        • SAP MM Course in Tamil
      • HR Management Course
      • Performance Marketing Course
      • Mern Stack Developer Course
        • Full Stack Developer Course in Kochi
        • Full Stack Developer Course in Trivandrum
        • Full Stack Developer Course in Calicut
        • Full Stack Developer Course in Pune
        • Full Stack Developer Course in Bangalore
        • Full Stack Developer Course in Hyderabad
        • Full Stack Developer Course in Chennai
        • Full Stack Developer Course in Indore
        • Full Stack Developer Course in Jaipur
        • Full Stack Developer Course in Coimbatore
      • Digital Marketing Training
        • Digital Marketing Course in Kochi
        • Digital Marketing Course in Trivandrum
        • Digital Marketing Course in Calicut
        • Digital Marketing Course in Kollam
        • Digital Marketing Course in Thrissur
        • Digital Marketing Course in Kottayam
        • Digital Marketing Course in Kannur
      • Montessori Teacher Training
        • Montessori Teacher Training in Calicut
        • Montessori Teacher Training in Kochi, Ernakulam
        • Montessori Teacher Training in Trivandrum
        • Montessori Teacher Training in Kollam
        • Montessori Teacher Training in Malayalam
        • Montessori Teacher Training in Kannada
      • Other Courses
        • German Language Course
        • OET Coaching
        • DHA Course
        • MOH Exam Coaching
        • Nurses Recruitment Abroad
        • FMGE Coaching
        • ChatGPT Course
        • Forex Trading Course
        • Yoga Teacher Training Course
        • Diploma in Early Childhood Care and Education
        • Business Administration & Hospital Management Course
        • Hospital and Healthcare Administration
        • AI for Teachers Course
    • Others
      • Railway
        • RRB Technician Notification
        • RRB JE Notification
        • RRB ALP Notification
        • RRB NTPC Notification
        • RRB RPF Notification
        • RRB RPF SI Notification
        • RRB RPF Constable Notification
        • RRB Group D Notification
        • RRB RPSF SI Notification
        • RRB SSE Notification
      • SSC
        • SSC CPO Notification
        • SSC MTS Notification
        • SSC CGL Notification
        • SSC CHSL Notification
        • SSC GD Constable Notification
        • SSC Stenographer Notification
        • SSC JE Notification
        • SSC CAPF Notification
        • SSC JHT Notification
        • Delhi Police Constable Notification
        • Delhi Police SI Notification
      • GATE
      • MAT
      • KMAT
        • KMAT Kerala 2024
      • TET
        • APTET
        • CTET
        • DSSSB
        • Karnataka TET
        • Kerala TET
        • KVS
        • MPTET
        • SUPER TET
        • TNTET
        • TSTET
        • UPTET
      • UPSC
        • UPSC CAPF Notification
        • UPSC CDS Notification
        • UPSC NDA Notification
        • UPSC Civil service Notification
    • Free Learn
      • Free Courses
        • Free Coding Courses
        • Free Accounting Courses
        • Free Digital Marketing Courses
        • Engineering Upskilling Courses
        • Free Hospital Administration Courses
        • Free OET Training
        • Free SAP Courses
        • Free Teachers Training Courses
        • Free Trading Courses
      • Question Answer
      • Aptitude Questions
      • Webinars
    • Test Prep
      • Kerala PSC Coaching
        • KPSC Degree Level Exam Preparation
        • Kerala PSC 12th Level Exam Preparation
        • Kerala PSC 10th Level Exam Preparation
        • KAS Coaching
        • Kerala PSC LDC Coaching
        • Kerala PSC LD Typist Coaching
        • Kerala PSC Fireman Coaching
        • KSFE Assistant Exam Preparation
        • Secretariat Office Attendant Coaching
        • Secretariat Assistant Coaching
        • Kerala PSC SI Exam Coaching
        • Khadi Board LDC Exam Preparation
        • Devaswom Board LDC Coaching
        • University LGS Exam Preparation
        • University Assistant Exam Coaching
        • KPSC Scientific Officer Exam Coaching
        • KPSC Probation Officer Grade II
        • KPSC Food Safety Officer Coaching
        • KWA Sanitary Chemist Coaching
        • KPSC Diary Farm Instructor Exam Coaching
        • Kerala PSC KWA Lab Assistant Exam Coaching
        • Kerala PSC ICDS Supervisor Exam Coaching
        • KPSC Finger Print Searcher Coaching
        • Kerala PSC Welfare Officer Gr. II Exam Coaching
        • KPSC Assistant Dental Surgeon Coaching
      • KPSC Teaching Exams
        • HSA Exam Preparation
        • KPSC HSA Social Science Coaching
        • KPSC HSA Physical Science Coaching
        • KPSC HSA English Coaching
        • KPSC Junior Language Teacher Hindi
        • KTET Coaching
        • SET Coaching
        • LP/UP Assistant Exam Coaching
        • HSST Exam Preparation
        • HSST Commerce Exam Coaching
        • Kerala PSC Lecturer in Diet Coaching
        • KVS PGT/TGT Coaching
      • Kerala PSC Technical Exams Coaching
        • Assistant Engineer Electrical Exam Coaching
        • Assistant Engineer Electronics Coaching
        • Assistant Engineer Mechanical Coaching
        • Kerala PSC Industries Extension Officer Coaching
        • KPSC LSGD AE Exam Coaching
        • KPSC Civil Engineering Exam Coaching
        • KPSC Mechanical Engineering Exam Coaching
        • KPSC Electrical Engineering Exam Coaching
        • KPSC Electronics Engineering Exam Coaching
        • KPSC Technical Computer Science Coaching
        • KPSC Tradesman Turning Coaching
        • Kerala PSC Overseer Exam Coaching
        • KPSC Assistant Town Planner Coaching
        • Lecturer in Polytechnic Electronics Coaching
      • Teaching Exams Coaching
        • CSIR NET Exam Coaching
        • EMRS Coaching
        • CTET Exam Online Coaching
      • IELTS Training Online
      • Bank Exam Coaching Online
        • SEBI Grade A Coaching
        • IBPS SO Online Coaching
        • IBPSC PO Online Coaching
        • IBPSC Clerk Online Coaching
        • SBI PO Coaching
        • SBI Clerk Online Coaching
        • SBI Apprentice Class
        • SBI SO Online Coaching
        • RBI Grade B Coaching
        • RBI Assistant Coaching
        • CSEB Exam Coaching
        • IBPS RRB Coaching
        • IBPS RRB PO Coaching
        • Canara Bank Po Exam Coaching
        • Kerala Gramin Bank Coaching
        • Kerala Bank Exam Coaching
        • JCI Exam Coaching
        • NABARD Grade A Coaching
        • LIC AAO Coaching Online
      • UPSC Online Coaching
        • UPSC CAPF Online Coaching
      • SSC Online Coaching
        • SSC JE Online Coaching
        • SSC CGL Coaching
        • SSC CGL AAO Coaching
        • SSC CGL CBI Inspector Coaching
        • SSC CHSL Coaching
        • SSC MTS Coaching
        • SSC Stenographer Coaching
        • SSC GD Online Coaching
      • RRB Exams Coaching
        • RRB RPF Exam Coaching
        • RRB NTPC Exam Coaching
        • RRB JE Online Coaching
        • RRB JE Electronics Coaching
        • RRB ALP Exam Coaching
        • RRB Technician Exam Coaching
      • CAT Online Coaching
      • CMAT Online Coaching
      • XAT Exam Coaching
      • GATE Online Coaching
        • GATE CE Online Coaching
        • GATE ME Online Coaching
        • GATE EE Online Coaching
      • NMAT Exam Coaching
      • AAI ATC Jr Executive Coaching
      • Cochin Shipyard Executive Trainee Coaching
      • BEL Probationary Engineer Coaching
      • HPCL Junior Executive Coaching

    © 2023 Entri.app - Privacy Policy | Terms of Service

    Chat