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 6736231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:06:20+00:00 2026-05-26T11:06:20+00:00

I had a look at this question here . The problem with this question

  • 0

I had a look at this question here. The problem with this question is this line:

Integer i3 = (Integer) -128; /*** Doesn't compile ***/

As some of the answer’s say’s:

The compiler interprets the - as the two-arg minus operator, i.e. it's trying to subtract 128 from some other number named Integer, but there's no such variable in scope

The answers look correct for me. Now in groovy I tried the same code as such before :

Integer i3 = (Integer) -128; /*** compiles!!! ***/

even this code of line compiles:

Integer i3 = (Integer) -(128); /*** compiles ***/

How does Groovy performing this operation? Does all Jvm languages does this? Whats happening behind the scene’s in case of Groovy.

Does this doesn’t break Java rule? Bit confused.

For reference I have tagged the working Groovy code here

Thanks in advance.

  • 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-26T11:06:21+00:00Added an answer on May 26, 2026 at 11:06 am

    Groovy isn’t Java.

    It doesn’t have to follow Java’s specification and in this case … doesn’t.

    Edit for clarity: I think what’s confusing you is that you don’t understand that these are two different languages. Both the Groovy compiler and the Java compiler output bytecode from your source code which then runs on the JVM (Java Virtual Machine). The JLS (Java Language Specification) applies to the Java language only. Groovy does not have to adhere to it.

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

Sidebar

Related Questions

I've already read this but it doesn't answer to my question. Here's my scenario:
I've had a look around for the answer to this, but I only seem
Yes, another IE fallback question. ;-) I had a look at the others here
Apologies if this was already asked but, I have had a look and can't
I recently had to take a quick look at Adobe InDesign server. In this
I've had a look at Stack Overflow question Initialization of a microSD card using
I've had a look at JFeed's readme and it doesn't mention anyway to get
This question is more to figure out how to look up classes and objects
I posted this question on the django-users list, but haven't had a reply there
im sorry if this has already been covered, i have had a look but

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.