Got Homework?
Connect with other students for help. It's a free community.
Here's the question you clicked on:
 0 viewing
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.
 7 months ago
 7 months 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.
 7 months ago
 7 months ago

This Question is Closed

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

e.mccormickBest ResponseYou've already chosen the best response.2
http://www.cs.umd.edu/~clin/MoreJava/Intro/exprintdiv.html
 7 months ago
See more questions >>>
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.