[] array name; B: Data type array name []; Recommendation is a way, B method forget it. But to be able to read (4) Initialization of an array A: Dynamic initialization gives only the length, the system gives the default value example: int[] arr = new INT[3]; B: Static initialization of the given value, the system determines the length example: int[] arr = new int[]{1,2,3}; Simplified version: int[] arr = {£ º}; (5) Java memory allocation
, the cost is greatly reduced, and reduce the occurrence of bugs2) decomposition of the processFor example, to make a steamed bread, his steps are: face, seasoning, cooking and other steps, each step we can be defined as a function, and then do a steamed bread is required to function is the one-way, and so on, each small step to execute the correct rate is higher than the overall operation.In summary, this section notes why you need to write a function, mainly because it provides efficiency and
Switch statements in Java:Here expression control expressions can only have data types of byte, short, char, int four integer types and enumeration types, and cannot be of type Boolean;Java7 (1.7) improved the Switch Branch statement;Java7 allows the control expression in the switch statement to be of type java.lang.String ( cannot be stringbuffer or StringBuilder)Switch (expression){Case Condition1:{statement (s);Break}Case Condition2:{statement (s);Break}Case Condition3:{statement (s);Break}..
(); atSystem.out.println ("sub.filed =" + Sub.field + -", Sub.getfield () =" + Sub.getfield () + -", Sub.getsuperfield () =" +Sub.getsuperfield ()); - } -}Output:sup.filed = 0, Sup.getfield () = 1sub.filed = 1, Sub.getfield () = 1, Sub.getsuperfield () = 0Analysis:The sub subclass actually contains two fields called field, whereas the default domain generated when referencing field in sub is not a super version of the Field field, so in order to get Super.field, you must explicitly indicate
After the transformation, began to enter the learning time, the following is the collation of learning notes C # and Java some differences between1, = = and equalsIn C #, the comparison of strings can be = = to compare, but in java use = = has always been false, originally in Java = = is used to see whether two references to the same memory address, equals is the value of the comparison object is equal, the total known string is the reference type of the2, switch the differenceIn C #, after the
1. The origin of the collection:We are learning object-oriented language, and object-oriented language is the description of things through objects, in order to facilitate the operation of multiple objects, we have to store these multiple objects. To store multiple objects, you cannot be a basic variable, but rather a variable of a container type, what are the container types in the knowledge we have learned? Arrays and StringBuffer. But what? The result of StringBuffer is a string that does not
long - * Float float - * Double double the * Char Character - * Boolean boolean - * - * Used for conversions between basic data types and strings. + */ - Public classIntegerdemo { + Public Static voidMain (string[] args) { A //No, the trouble is coming. at //Public static String tobinarystring (int i) -System.out.println (integer.tobinarystring (100)); - //Public static String tooctalstring (int i) -System.out.println (integer.tooctalstring (100)); -
responsible for accepting user input, and informs the second class object (Checkerboard object) The change of the chess piece layout, the Checkerboard object receives the change of the chess piece to be responsible to show this change on the screen, and uses the third kind of object (rule system) to decide the chess game.For a novice, want to put the object-oriented thinking in the development of the use of the easy, is not a simple thing, has been said object-oriented is a kind of thought, tha
immediately but may be satisfied at some point in the future, and these four forms are handled differently: the first is to throw an exception, and the second is to return a special value (null or false, depending on the operation), the third is to block the current thread indefinitely until the operation succeeds, and the fourth is to block only within the given maximum time limit before discarding. These methods are summarized in the following table:
Throw except
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.