Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6350091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:44:51+00:00 2026-05-24T21:44:51+00:00

In Java, < has higher priority than ==. In Scala it’s vice versa. I

  • 0

In Java, < has higher priority than ==. In Scala it’s vice versa. I wonder why Scala people chose that way? Other binary operator precedences align with Java (exept bitwise ops, but it’s understandable why they didn’t give special precedences for those).

UPDATE: It was actually a mistake in the language spec, ‘<‘ has actually higher priority than ‘==’ in Scala.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T21:44:52+00:00Added an answer on May 24, 2026 at 9:44 pm

    It’s not inversed in Scala. Try this:

    val what = 5 == 8 < 4
    

    I get a compile-time warning: comparing values of types Boolean and Int using `==' will always yield false; so obviously the compiler has translated this to 5 == (8 < 4), just like in Java.

    You can try this, too:

    class Foo {
      def ===(o: Foo) = { println("==="); this }
      def <<<(o: Foo) = { println("<<<"); this }
      def >>>(o: Foo) = { println(">>>"); this }
    }
    
    def foo = new Foo
    

    Then calling foo === foo <<< foo >>> foo prints this:

    <<<
    >>>
    ===
    

    Which means it was parsed as (foo === ((foo <<< foo) >>> foo))

    Can you provide an example where the precedence is reversed?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Java has a lot of frameworks / APIs that help you do logging in
C++ has std::vector and Java has ArrayList , and many other languages have their
What's the data structure in Java that has the fastest operation for contains() ?
Java has annotations and that is good. However, some developers feel that it is
As I noticed on oracle.com that Java has no support for XML literal in
Java has a Properties class that is nice for saving basic configuration information, e.g.
A simple question that I don't know if Java has also a simple solution.
My virtual memory won't go higher than 2GB when I has 8GB available. I'm
Java has generics and C++ provides a very strong programming model with template s.
Java has a convenient split method: String str = The quick brown fox; String[]

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.