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

正文內(nèi)容

網(wǎng)上書店管理系統(tǒng)外文資料翻譯-管理系統(tǒng)(更新版)

2025-03-12 02:53上一頁面

下一頁面
  

【正文】 id nothing2() {} When the return type is void, then the return keyword is used only to exit the method, and is therefore unnecessary when you reach the end of the method. You can return from a method at any point, but if you?ve given a nonvoid return type, then the piler will force you (with error messages) to return the appropriate type of value regardless of where you return. At this point, it can look like a program is just a bunch of objects with methods that take other objects as arguments and send messages to those other objects. That is indeed much of what goes on, but in the following chapter you?ll learn how to do the detailed lowlevel work by making decisions within a method. For this chapter, sending messages will suffice. 。 For example, suppose you have a method f( ) that takes no arguments and returns a value of type int. Then, if you have an object called a for which f( ) can be called, you can say this:int x = ()。} This class doesn?t do anything except hold data. But you can create an object like this: DataOnly data = new DataOnly()。 q available }// Only x available// q is out of scope } A variable defined within a scope is available only to the end of that text after a ?//? to the end of a line is a makes Java code easier to read. Since Java is a freeform language, the extra spaces, tabs, and carriage returns do not affect the resulting cannot do the following, even though it is legal in C and C++:{ int x = 12。 Character ch = new Character(c)。大體上確實是這樣,但在以后章節(jié)中,讀者將會學到怎樣在一個方法內(nèi)進行判斷,做一些更細致的底層工作。 你可以定義方法返回任意想要的類型, 如果不想返回任何值,可以指示此方法返回 void(空)。 Int storage(String s){ Return ()*2。在上面的例子中,消息是 f(),對象是 a。方法只有通過對象才能被調(diào)用,且這個對象必須能執(zhí)行這個方法調(diào)用。實際上,繼續(xù)把它看作是函數(shù)也無妨。 然而上述確保初始化的方法并不適用于“局部”變量(即非某個類的字段)。 想修改的數(shù)據(jù)也有可能位于對象所包含的其他對象中。下面是一個具有某 些字段的類: Class DataOnly{ int i。因此,你還不能用它做太多的事情。隨后,釋放這些對象的內(nèi)存空間,以便供其他新的對象使用。在后繼章節(jié)中,讀者將會看到:在程序執(zhí)行過程中,怎樣傳遞和復制引用。所以,在 C和 C++里將一個較大作用域的變量“隱藏”起來的做法,在 Java 里是不允許的。 //both x amp。 數(shù)組將在以后的章節(jié)中詳細討論。這種范圍檢查,是以每個數(shù)組上少量的內(nèi)存開銷及運行時的下標檢查為代價的。也就是說,在運算中,可以準確地表示任何大小的整數(shù)值,而不會丟失任何信息。 高精度數(shù)字 Java 提供了兩個用于高精度計算的類: BigInteger 或 BigDecimal。這種所占存儲空間大小的不變性是 Java 程序比用其他大多數(shù)語言編寫的程序更具可移植性的原因。 特例:基本 類型 在程序設(shè)計中經(jīng)常用到一系列類型,他們需要特殊對待。若數(shù)據(jù)完全獨立于一個程序之外,則程序不運行時仍可存在,并在程序的控制范圍之外。要求創(chuàng)建一個對象時,只需要用 new 命令編制相關(guān)的代碼即可。這是一種特別快、特別有效的數(shù)據(jù)保存方式,僅次于寄存器。特別要注意的是內(nèi)存的分配。 New 的意思是:“把我變成這些對象的一種新類型”。 但這里創(chuàng)建的只是句柄,并不是對象。在其他 Java 參考書里,還可看到有的人將其稱作一個“引用”,甚至一個“指針”。也就是說,正式用它設(shè)計之前, 必須先將自己的思想轉(zhuǎn)入一個面向?qū)ο蟮氖澜纾ǔ窃缫蚜晳T了這個世界的思維方式)。 畢業(yè)設(shè)計 (論文 )外文資料翻譯 系 : 信息工程學院 專 業(yè): 計算機科學與技術(shù) 姓 名: xxxxxx 學 號: xxxxxxxxx 外文出處: 附 件: ; 。 Java 語言首先便假定了我們只希望進行面向?qū)ο蟮某绦蛟O(shè)計。但要注意,盡管一切都“看作”對象,但操縱的標識符實際是指向一個對象的“句柄”( Handle)。所以如果想容納一個詞或句子,可創(chuàng)建一個 String 句柄 : String s。通常用 new 關(guān)鍵字達到這一目標。 存儲 到什么地方 程序運行時,我們最好對數(shù)據(jù)保存到什么地方做到心中有數(shù)。堆棧指針若向下移 , 會創(chuàng)建新的內(nèi)存;若向上移,則會釋放那些內(nèi)存。因此,用堆保存數(shù)據(jù)時會得到更大的靈活性。 ( 5)非 RAM 存儲。 Java 提供了對 輕量級持久化的支持,而諸如 JDBC 和 Hibernate 這樣的機制提供了更加復雜的對數(shù)據(jù)庫中存儲和讀取對象信息的支持。他們的大小并不像其他大多數(shù)語言那樣隨機器硬件架構(gòu)的變化而變化。 包裝基本類型的原因?qū)⒃谝院蟮恼鹿?jié)中說明。 BigInteger 支持任意精度的整數(shù)。 Java 確保數(shù)組會被初始化,而且不能在它的范圍之外被訪問。同樣,編譯器也能確保這種數(shù)組的初始化,因為它會將這種數(shù)組所占的內(nèi)存全部置零。 //Only x available { int q = 96。 //illegal } } 編譯器將會報告變量 x已經(jīng)定義過。在這一 小段代碼中,我們無法在這個作用域之后 訪問這個對象,因為 對它唯一的引用已超出了作用域的范圍。 Java 有一個垃圾回收器,用來監(jiān)視用 new 創(chuàng)建的所有對象,并辨別那些不會再被引用的對象。例如: class ATypeName {/*Class body goes here*/} 這就引入了一種新的類型,盡管類主體僅包含一條注釋語句(星號和斜杠以及其中的內(nèi)容就是注釋,本章后面再討論)。 每個對象都有用來存儲其字段的空間;普通字段不能在對象間共享。 = false。所以最好明確地對變量進行初始化。 方法、參數(shù)和返回值 許多程序設(shè)計語言(像 C 和 C++)用函數(shù)這個術(shù)語來描述命名子程序;而在 Java 里卻常用方法這個術(shù)語來表示“做某些事情的方式”。 Java 中的方法只能作為類的一部分來創(chuàng)建。 這種調(diào)用方法的行為通常被稱為發(fā)送消息給對象。 假設(shè)某個方法接受 String 為其參數(shù),下面是其具體定義,它必須置于某個類的定義內(nèi)才能被正確編譯。在這個例子中,返回值是通過計算 ()*2 這個表達式得到的。 到此為止,讀者或許覺得:程序視乎只是一系列帶有方法的對象組合,這些方法以其他對象為參數(shù),并發(fā)送消息給其他對象。 it is only defined to be able to take the literal values true or “wrapper” classes for the primitive data types allow you to make a nonprimitive object on the heap to represent that primitive type. For example: char c = ?x?。// Both x amp。boolean b。 it will not automatically be initialized to zero. You are responsible for assigning an appropriate value before you use x. If you fet, Java definitely improves on C++: You get a piletime error telling you the variable might not have been initialized. (Many C++ pilers will warn you about uninitialized variables, but in Java these are errors.) Methods,arguments,and return values In many languages (like C and C++), the term function is used to describe a named subroutine. The term that is more monly used in Java is method, as in “a way to do something.” If you want, you can continue thinking in terms of functions. It?s really only a syntactic difference, but this book follows the mon Java usage of the term “method” Methods in Java determine the messages an object can receive. The fundamental parts of a method are the name, the arguments, the return type, and the body. Here is the basic form: ReturnType methodName( /* Argument list */ ) { /* Method body */} The return type describes the value that es back from the method after you call it. The argument list gives the types and names for the information that you want to pass into the method. The method name and argument list (which is called the signature of the method) uniquely identify that method. Methods in Java can be created only as part of a class. A method can be called only for an object,3 and that object must be able to perform that method call. If you try to call the wrong method for an object, you?ll get an error message at pile time. You call a method for an object by naming the object followed by a period (dot), followed by the name of the method and its argument list, like this:object Name. method N ame(arg1, arg2, arg3)
點擊復制文檔內(nèi)容
畢業(yè)設(shè)計相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1