A community for students.
Here's the question you clicked on:
 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.
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

e.mccormick
 2 years ago
Best ResponseYou've already chosen the best response.2a and b are ints. What is integer division in Java? 32/10= ?? vs 32.0/10.0= ??

e.mccormick
 2 years ago
Best ResponseYou've already chosen the best response.2http://www.cs.umd.edu/~clin/MoreJava/Intro/exprintdiv.html
Ask your own question
Sign UpFind more explanations on OpenStudy
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.