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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:12:01+00:00 2026-06-10T09:12:01+00:00

Why does: System.out.println((3 + 7 + 10) * (1000 – 8) / (992 –

  • 0

Why does:

System.out.println((3 + 7 + 10) * (1000 - 8) / (992 - 17))

print 3 and not 20?

System.out.println (2.0 + 1.0/2 + 1.0/6 + 1.0/24 + 1.0/120)

print 2.7166666666666663 and not 2.716666667?

System.out.println (2147483647 + 1)

print -2147483648 and not 2147483648?

  • 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-06-10T09:12:03+00:00Added an answer on June 10, 2026 at 9:12 am

    System.out.println((3 + 7 + 10) * (1000 – 8) / 992 – 17) print 3 and not 20?

    Order of operations. Evaluate the parenthesis first to get (20) * (992) / 992 – 17. Then, multiplication and division from left to right to get 20 – 17. Finally, subtraction to get 3.

    System.out.println (2.0 + 1.0/2 + 1.0/6 + 1.0/24 + 1.0/120) print 2.7166666666666663 and not 2.716666667?

    Floating point arithmetic. There are lots of questions here on Stack Overflow about floating point math, and a quick Google search will probably turn up more than you could ever need. The Wikipedia article might be a good start, though.

    System.out.println (2147483647 + 1) print -2147483648 and not 2147483648?

    Overflow. The maximum value of an integer in Java is 2^31 – 1 or 2,147,483,647. When you add one to that value, it wraps around to the value you see. It has to do with the binary representation of the value using 2s compliment.

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

Sidebar

Related Questions

InetAddress byName = InetAddress.getByName("173.39.161.140"); System.out.println(byName); System.out.println(byName.isReachable(1000)); Why does isReachable return false ? I can
Why does System.out.println(-1<<32) display -1 in Java? Is there any root cause? I hope
This prints 83 System.out.println(0123) However this prints 123 System.out.println(123) Why does it work that
Why does .* and .+ give different results? System.out.println(foo.replaceAll(.+, bar)); // --> bar System.out.println(foo.replaceAll(.*,
Why does this int x = 2; for (int y =2; y>0;y--){ System.out.println(x +
Does anyone know why: public void foo() { System.out.println(Hello); return; System.out.println(World!); } Would be
Just out of curiosity, how does iostream access the input-output system. (I have a
I'm trying this simple calculation in a Java application: System.out.println(b= + (1 - 7
public static void main(String[] args) { System.out.println(fun(2,3,4)); } static int fun(int a,int b,int c)
System.out.println(Integer.MAX_VALUE + 1 == Integer.MIN_VALUE); is true. I understand that integer in Java is

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.