久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

這個(gè)部門有什么問題?

What#39;s wrong with this division?(這個(gè)部門有什么問題?)
本文介紹了這個(gè)部門有什么問題?的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

代碼如下:

class testsum
{ 
    public static void main(String arg[]) 
    {
        double sum=0; 
        double fraction;
        fraction=-1/9;
        System.out.println("fraction: "+fraction); 
        fraction=-1; 
        fraction=fraction/9; 
        System.out.println("fraction: "+fraction); 
    } 
} 

輸出是 0 然后是 -0.11111111

為什么第一個(gè)輸出是 0 而不是 -0.11111111111?

why was the first output 0 and not -0.11111111111?

推薦答案

它在第一個(gè)示例中進(jìn)行整數(shù)除法,因?yàn)檫@是數(shù)字文字的默認(rèn)類型.嘗試將其更改為 -1.0/9(或 1d/9d - d 后綴表示 double),您應(yīng)該會(huì)得到相同的答案.

It's doing integer division in the first example as this is the default type for a numeric literal. Try changing it to -1.0/9 (or 1d/9d - the d suffix indicates a double) and you should get the same answer.

這篇關(guān)于這個(gè)部門有什么問題?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

How to wrap text around components in a JTextPane?(如何在 JTextPane 中的組件周圍環(huán)繞文本?)
MyBatis, how to get the auto generated key of an insert? [MySql](MyBatis,如何獲取插入的自動(dòng)生成密鑰?[MySql])
Inserting to Oracle Nested Table in Java(在 Java 中插入 Oracle 嵌套表)
Java: How to insert CLOB into oracle database(Java:如何將 CLOB 插入 oracle 數(shù)據(jù)庫)
Why does Spring-data-jdbc not save my Car object?(為什么 Spring-data-jdbc 不保存我的 Car 對(duì)象?)
Use threading to process file chunk by chunk(使用線程逐塊處理文件)
主站蜘蛛池模板: 国产精品九九 | 日韩精品免费在线 | 一区二区免费视频 | 亚洲国产精品一区二区三区 | 精品一二三区 | 伊人网国产 | 中文字幕免费中文 | 国产精品自产拍在线观看蜜 | 亚洲国产二区 | 久久亚洲综合 | 99视频在线免费观看 | 欧美在线a | 福利一区在线观看 | 国产精品综合一区二区 | 免费成人高清在线视频 | 精品日韩| 欧美淫| 999精品视频 | 在线亚洲电影 | 亚洲成人高清 | 国产成人精品a视频一区www | 久久久精品视 | av在线播放国产 | 久久久久精 | 91亚洲精选 | 五月婷六月丁香 | 欧美6一10sex性hd | 婷婷中文字幕 | 亚洲精品二区 | 不卡视频一区二区三区 | 黄网站在线播放 | 一级全黄少妇性色生活免费看 | 波多野结衣av中文字幕 | 亚洲午夜视频 | 涩涩操| 91精品国产色综合久久不卡蜜臀 | 99免费在线观看 | 国产三级一区二区三区 | 国产视频久 | 精品一二区 | 宅女噜噜66国产精品观看免费 |