Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

Brenar

  • 2 years ago

Java, netbeans. Why does the following code get an output of 3.0? int a = 32, b = 10; double c = a/b; System.out.println( "The value of c is " + c ); I know that double treats values as integers, yes? So if I did: double a = 32, b = 10; double c = a/b; System.out.println("The value of c is" + c); I guess I'd just like clarification between the types of data int and double handle.

  • This Question is Closed
  1. e.mccormick
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 2

    a and b are ints. What is integer division in Java? 32/10= ?? vs 32.0/10.0= ??

  2. e.mccormick
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 2

    http://www.cs.umd.edu/~clin/MoreJava/Intro/expr-int-div.html

  3. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy