In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces "what is the difference between 1+1d/5 in java and 1x5x5". In daily operation, I believe that many people have doubts about the difference between java and 1+1d/5. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful for you to answer the question of "what is the difference between 1+1d/5 in java and 1x5x5"! Next, please follow the editor to study!
Catalogue
The difference between java 1+1d/5 and 1 / 1 / 1 / 2 / 5
The main difference is that the data types are different
Calculate 1 pound, 1 beat, 2 steps, 3 steps, 20 steps! Sum
The main difference between java 1+1d/5 and 1: 1 / 5 is that the data types are different.
The result of 1+1d/5 is 1.2, which is of type double. Because 1D is the double type, the 1d/5 result is automatically promoted to the double type and the 1+1d/5 result is automatically promoted to the double type. .
The result 1 of 1 is int, because 1 is divisible (will lose the precision of the decimal part.) . Both operands are of type int. Finally, add 1 or int type. So the result is the int type.
The java reference code is as follows
Public class Test {public static void main (String [] args) {double num1 = 1 + 1D / 5; System.out.println (num1); / / output 1.2 int num2 = 1x 1 / 5; System.out.println (num2); / / output 1}} calculates 1x, 1max, 2pm, 2pm, 1max, 1max, 2pm, 1max, 2k, 2k, 2k, 2s, 2s, 2s, 2s, 1s, 2s, 1s, 2s, 1s, 2s, 1s, 2s, 1s, 2s, 1s, 2s, 1s, 2s, 1s, 1s, 2s, 1s, 1s, 2s, 1s, 2s, 1s, 1s, 2s, 1s, 1s, 2s, 1s, 1s, 2s, 1s, 1s, 2s, 1s, 1 Sum
The original title: calculate 1 pound, 1 pound, 2 cycles, 1 stroke, 3 cycles +. + 1PUX 20! Sum
Observe the topic, the difficulty of this question is to calculate the factorial, you might as well use a cycle to calculate the factorial, and then use a cycle to calculate from 1 to 1! To 1x20! Donovan and. The code is as follows
Package java1;public class sum {public static void main (String args []) {/ / denote the factorial result int slots 1 with s; double sum=0; / / calculate 1 prime 1! To 1x20! And for (int iTune1)
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.