• Post Reply Bookmark Topic Watch Topic
  • New Topic

result using Arrays  RSS feed

 
Dana Horst
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello guys! I have the following code:



an get a result :

array1: [7 4 8 1 4 1 4]
array2: [7.0 4.0 8.0]

My question is: how and why did we get ".0" in array2: [7.0 4.0 8.0] ?
Thank you

 
Paweł Baczyński
Bartender
Posts: 2087
44
Firefox Browser IntelliJ IDE Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because you convert values to float. PrintStream.print() prints "integer" floats with ".0".
 
Dana Horst
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All right. Spasibo!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!