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

正文內(nèi)容

外文資料翻譯--一切都是對(duì)象(文件)

 

【正文】 en in your programming, gets special treatment. You can think of these as “primitive” types. The reason for the special treatment is that to create an object with new—especially a small, simple variable—isn?t very efficient, because new places objects on the heap. For these types Java falls back on the approach taken by C and C++. That is, instead of creating the variable by using new, an “automatic” variable is created that is not a reference. The variable holds the value directly, and it?s placed on the stack, so it?s much more efficient. Java determines the size of each primitive type. These sizes don?t change from one machine architecture to another as they do in most languages. This size invariance is one reason Java programs are more portable than programs in most other numeric types are signed, so don?t look for unsigned size of the boolean type is not explicitly specified。 Java SE5 autoboxing will automatically convert from a primitive to a wrapper type: Character ch = ?x?。// Only x available{ int q = 96。 // Illegal}}The piler will announce that the variable x has already been defined. Thus the C and C++ ability to “hide” a variable in a larger scop e is not allowed, because the Java designers thought that it led to confusing programs. Scope of objects Java objects do not have the same lifetimes as primitives. When you create a Java object using new, it hangs around past the end of the scope. Thus if you use:{String s = new String(a string)。double d。 = 。 Then x will get some arbitrary value (as in C and C++)。 } This method tells you how many bytes are required to hold the information in a particular String. (The size of each char in a String is 16 bits, or two bytes, to support Unicode characters.) The argument is of type String and is called s. Once s is passed into the method, you can treat it just like any other object. (You can send messages to it.) Here, the length( ) method is called, which is one of the methods for Strings。 } void 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. 。 } double naturalLogBase() { return 。 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 = ()。 It is also possible that your object might contain other objects that contain data you?d like to modify. For this, you just keep “connecting the dots.” For example: = 100。} This class doesn?t do anything except hold data. But you can create an object like this: DataOnly data = new DataOnly()。 Fields and methods When you define a class (and all you do in Java is define classes, make objects of those classes, and send messages to those objects), you can put two types of elements in your class: fields (sometimes called data members), and methods (sometimes called member functions). A field is an object of any type that you can talk to via its reference, or a primitive type. If it is a reference to an object, you must initialize that reference to connect it to an actual object (using new, as seen earlier). Each object keeps its own storage for its fields。 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。 The reasons for wrapping primitives will be shown in a later chapter. Highprecision numbers Java includes two classes for performing highprecision arithmetic: BigInteger and BigDecimal. Although these approximately fit into the same category as the “wrapper” classes, neither one has a primitive classes have methods that provide analogues for the operations that you perform on primitive types. That is, you can do anything with a BigInteger or BigDecimal that you can with an int or float, it?s just that you must use method calls instead of operators. Also, since there?s more involved, the operations will be slower. You?re exchanging speed for accuracy. BigInteger supports arbitraryprecision integers. This means that you can accurately represent integral values of any size without losing any information during operations. BigDecimal is for arbitraryprecision fixedpoint numbers。 Character ch = new Character(c)。However, this uses a special Java feature: Strings can be initialized with quoted text. Normally, you must use a more general type of initialization for objects. You must create all the objects When you create a reference, you want to connect it with a new object. You do so, in general, with the new operator. The keyword new says, “Make me a new one of these objects.” So in the preceding example, you can say:String s = new String(asdf)。大體上確實(shí)是這樣,但在以后章節(jié)中,讀者將會(huì)學(xué)到怎樣在一個(gè)方法內(nèi)進(jìn)行判斷,做一些更細(xì)致的底層工作。} void nothing2(){} 若返回類型是 void,return 關(guān)鍵字的作用只是用來(lái)推出方法。 你可以定義方法返回任意想要的類型, 如果不想返回任何值,可以指示此方法返回 void(空)。在這里, s 的 length()方法被調(diào)用,它是 String 類提供的方法之一,會(huì)返回字符串 包含的字符數(shù)。 Int storage(String s){ Retu
點(diǎn)擊復(fù)制文檔內(nèi)容
畢業(yè)設(shè)計(jì)相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1