freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

計(jì)算機(jī)科學(xué)與技術(shù)外文資料翻譯-其他專(zhuān)業(yè)-文庫(kù)吧

2025-12-16 02:18 本頁(yè)面


【正文】 度的計(jì)算: BigInteger 和 BigDecimal。盡管它們大致可以劃分為“封裝器”類(lèi)型,但兩者都沒(méi)有對(duì)應(yīng)的“主類(lèi)型”。 這兩個(gè)類(lèi)都有自己特殊的“方法”,對(duì)應(yīng)于我們針對(duì)主類(lèi)型執(zhí)行的操作。也就是說(shuō),能對(duì) int 或 float 做的事情,對(duì) BigInteger 和 BigDecimal 一樣可以做。只是必須使用方法調(diào)用,不能使用運(yùn)算符。此外,由于牽涉更多,所以運(yùn)算速度會(huì)慢一些。我們犧牲了速 度,但換來(lái)了精度。 BigInteger 支持任意精度的整數(shù)。也就是說(shuō),我們可精確表示任意大小的整數(shù)值,同時(shí)在運(yùn)算過(guò)程中不會(huì)丟失任何信息。 BigDecimal 支持任意精度的定點(diǎn)數(shù)字。例如,可用它進(jìn)行精確的幣值計(jì)算。 至于調(diào)用這兩個(gè)類(lèi)時(shí)可選用的構(gòu)建器和方法,請(qǐng)自行參考聯(lián)機(jī)幫助文檔。 6. Java 的數(shù)組 幾乎所有程序設(shè)計(jì)語(yǔ)言都支持?jǐn)?shù)組。在 C 和 C++里使用數(shù)組是非常危險(xiǎn)的,因?yàn)槟切?shù)組只是內(nèi)存塊。若程序訪問(wèn)自己內(nèi)存塊以外的數(shù)組,或者在初始化之前使用內(nèi)存(屬于常規(guī)編程錯(cuò)誤),會(huì)產(chǎn)生不可預(yù)測(cè)的后果。在 C++里,應(yīng)盡量不要使用數(shù)組,換用標(biāo)準(zhǔn)模板庫(kù)( Standard TemplateLibrary)里更安全的容器。 Java 的一項(xiàng)主要設(shè)計(jì)目標(biāo)就是安全性。所以在 C和 C++里困擾程序員的許多問(wèn)題都未在 Java里重復(fù)。一個(gè) Java 可以保證被初始化,而且不可在它的范圍之外訪問(wèn)。由于系統(tǒng)自動(dòng)進(jìn)行范圍檢查,所以必然要付出一些代價(jià):針對(duì)每個(gè)數(shù)組,以及在運(yùn)行期間對(duì)索引的校驗(yàn),都會(huì)造成少量的內(nèi)存開(kāi)銷(xiāo)。但由此換回的是更高的安全性,以及更高的工作效率。為此付出少許代價(jià)是值得的。 創(chuàng)建對(duì)象數(shù)組時(shí),實(shí)際創(chuàng)建的是一個(gè)句柄數(shù)組。而且每個(gè) 句柄都會(huì)自動(dòng)初始化成一個(gè)特殊值,并帶有自己的關(guān)鍵字: null(空)。一旦 Java 看到 null,就知道該句柄并未指向一個(gè)對(duì)象。正式使用前,必須為每個(gè)句柄都分配一個(gè)對(duì)象。若試圖使用依然為 null 的一個(gè)句柄,就會(huì)在運(yùn)行期報(bào)告問(wèn)題。因此,典型的數(shù)組錯(cuò)誤在 Java 里就得到了避免。 也可以創(chuàng)建主類(lèi)型數(shù)組。同樣地,編譯器能夠擔(dān)保對(duì)它的初始化,因?yàn)闀?huì)將那個(gè)數(shù)組的內(nèi)存劃分成零。 數(shù)組問(wèn)題將在以后的章節(jié)里詳細(xì)討論。 7. 絕對(duì)不要清除對(duì)象 在大多數(shù)程 如何幫助我們完成所有清除工作,從而極大了簡(jiǎn)化了這個(gè)問(wèn)題。 8. 作用域 大多數(shù)程序設(shè)計(jì)語(yǔ)言都提供了“作用域”( Scope)的概念。對(duì)于在作用域里定義的名字,作用域同時(shí)決定了它的“可見(jiàn)性”以及“存在時(shí)間”。在 C, C++和 Java里,作用域是由花括號(hào)的位置決定的。參考下面這個(gè)例子: { int x = 12。 { int q = 96。 } } 作為在作用域里定義的一個(gè)變量,它只有在那個(gè)作用域結(jié)束之前才可使用。 在上面的例子中,縮進(jìn)排版使 Java 代碼更易辨讀。由于 Java 是一種形式自由的語(yǔ)言,所以額外的空格、制表位以及回車(chē)都不會(huì)對(duì)結(jié)果程序造成影響。 注 意盡管在 C 和 C++里是合法的,但在 Java 里不能象下面這樣書(shū)寫(xiě)代碼: { int x = 12。 { int x = 96。 } } 編譯器會(huì)認(rèn)為變量 x 已被定義。所以 C 和 C++能將一個(gè)變量“隱藏”在一個(gè)更大的作用域里。但這種做法在 Java 里是不允許的,因?yàn)?Java 的設(shè)計(jì)者認(rèn)為這樣做使程序產(chǎn)生了混淆。 9. 對(duì)象的作用域 Java 對(duì)象不具備與主類(lèi)型一樣的存在時(shí)間。用 new 關(guān)鍵字創(chuàng)建一個(gè) Java 對(duì)象的時(shí)候,它會(huì)超出作用域的范圍之外。所以假若使用下面這段代碼: 附件 2:外文原文 (復(fù)印件 ) Everything is an Object Although it is based on C++, Java is more of a “pure” objectoriented language. Both C++ and Java are hybrid languages, but in Java the designers felt that the hybridization was not as important as it was in C++. A hybrid langua ge allows multiple programming styles。 the reason C++ is hybrid is to support backward patibility with the C language. Because C++ is a superset of the C language, it includes many of that language?s undesirable features, which can make some aspects of C++ overly plicated. The Java language assumes that you want to do only objectoriented programming. This means that before you can begin you must shift your mindset into an objectoriented world (unless it?s already there). The benefit of this initial effort is the ability to program in a language that is simpler to learn and to use than many other OOP languages. In this chapter we?ll see the basic ponents of a Java program and we?ll learn that everything in Java is an object, even a Java program. You manipulate objects with references Each programming language has its own means of manipulating data. Sometimes the programmer must be constantly aware of what type of manipulation is going on. Are you manipulating the object directly, or are you dealing with some kind of indirect representation (a pointer in C or C++) that must be treated with a special syntax? All this is simplified in Java. You treat everything as an object, using a single consistent syntax. Although you treat everything as an object, the identifier you manipulate is actually a “reference” to an object. You might imagine this scene as a television (the object) with your remote control (the reference). As long as you?re holding this reference, you have a object connected to it. So if you want to hold a word or sentence, you create a String reference: String s。But here you?ve created only the reference, not an
點(diǎn)擊復(fù)制文檔內(nèi)容
法律信息相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1