JAVA object reference, object assignment (conversion), and java assignment
Link: http://zwmf.iteye.com/blog/1738574
Keywords: java object referenceJava object and its referenceSome basic concepts about objects and references.When I was a beginner in
Java Foundation-assignment operator assignment Operators with conditional operator condition OperatorsYun ZhengjieCopyright Notice: Original works, declined reprint! Otherwise, the legal liability will be investigated.I. Assignment operators The data type of an expression is compatible with the type of the left variab
JAVA value assignment operator and value assignment operator
Assign a value to the budget operator. Simply put, assign the variable value that defines the value to the variable you just defined.
For example, the score of student a is the same as that of Student B. The score of student a is 80. Based on the score of student a, the score of student B is output.
The string type is a commonly used type in the actual work, separated from the data type, string is a reference type and is a class defined in the API. So objects of type string can be created using new, such as String Name=new string ("string"), assigning the variable name to a value of "string", but string analogy other classes are somewhat special, can use ' = ' to directly assign values, such as String Name= "string", which is also assigned to the variable name, a value of "string", the two
+ + self-increment front: First operation after the value a=3; B=++a; a=4; b=4;+ + + self-increment: First take value after Operation A=3; b=a++; a=4; b=3;--self-reducing pre-set: First operation after the value a=3; b=--a;a=2;b=2;--Self-reduction after: the first value after the Operation A=3;b=a--;a=2;b=3;The preceding is the first operation after the value is set after the value of the operation.Assignment Operation +Extended Assignment Operation +
To assign values to different variables, you must use the assign operator "=". Here "=" does not mean "equal to", but "assign value". For example:
A1 = 3;
This statement is used to assign integer 3 to variable a1. Make the value of variable a1 3 at this time. Let's look at the following statement:
A1 = a1 + 1;
As you know, this representation method won't work in mathematics, but as a value assignment statement, it is often used in future programming,
Java help document download, java help document
JAVA help documentation full JDK1.5 JDK1.6 JDK1.7 official Full Version DownloadJDK (Java Development Kit,
Help Java to read text and help java to read text
JAVA provides the most basic file processing functions and can read small text files in a simple and non-structured manner, if you encounter large files that require structuring, diverse formats, and special requirements, or
when using eclipse for Java Program development, you always need to open a jdk1.5 CHM file at the same time, then open the eclipse help to find the API details. If JDK documentation can be displayed in eclipse help, it will be much easier. In particular, Sun China's technical community has translated the original English JDK documentation, which makes it even
Tag: Represents the instance tin Judgment array comes with a GPO Java object(a) Learning summary1. In Java, through the scanner class to complete console input, consult the JDK Help document, scanner class implementation of basic data input method? Can not only use text description, must write code, through specific examples to explain. Scanner这个类,可以很方便的从控制台读取内
From http://www.cnblogs.com/ggjucheng/archive/2012/12/15/2819621.html
English from http://docs.oracle.com/javase/tutorial/java/nutsandbolts/op1.html Simple value assignment operator
One of the most common operators is the simple value assignment operator "=". It grants the value from the right of the operator to the left:
Int Cadence = 0; int speed = 0; int
Assignment operators in JavaAn assignment operator is a symbol that specifies a numeric value for a variable or constant. If you can use "=" to assign the result of the right expression to the left operand.Common assignment operators supported by Java, as shown in the following table:650) this.width=650; "src=" http://
Question: i + = j is just the shorthand for i = i + j?Answer: not also! Look at the following program:int i = 5; long j = 8+ = j; // can be compiled and the result is correct i = i + j; // cannot compile, type conversion issuesIn fact, Java will convert i + = j to i = (int) (i + j) to execute.Typically, a compound assignment expression in the form of a E1 op= E2 is equivalent to E1 = (t) ((E1) + (E2))
. All browsers of the IE series cannot tolerate such errors.
3 JSON cannot tolerate the end comma.
{"Name": "zhao", "age": 12} // The correct JSON format {"name": "zhao", "age": 12 ,} // incorrect JSON format
It should be noted that JSON is a common data format and has nothing to do with a specific programming language. Different languages also adopt different levels of tolerance when decoding JSON. PHP json_decode () cannot tolerate the end comma.
Json_decode ({"name": "zhao", "age": 12,}); //
,j;public void Test_m (test a){Test b = new Test ();B.I = 1;B.J = 2;A = b;}public void test_m1 (test a){A.I = 1;A.J = 2;}public static void Main (String argv[]){Test t= new test ();T.I = 5;T.J = 6;System.out.println ("t.i =" + t.i + "t.j=" + T.J); 5,6T.test_m (t);System.out.println ("t.i =" + t.i + "t.j=" + T.J); 5,6,a and T both point to an object, and in test_m s it points to another object, so the object T is the same!!!T.TEST_M1 (t);System.out.println ("t.i =" + t.i + "t.j=" + T.J); The}}The
= b;}public void test_m1 (test a){A.I = 1;A.J = 2;}public static void Main (String argv[]){Test t= new test ();T.I = 5;T.J = 6;System.out.println ("t.i =" + t.i + "t.j=" + T.J); 5,6T.test_m (t);System.out.println ("t.i =" + t.i + "t.j=" + T.J); 5,6,a and T both point to an object, and in test_m s it points to another object, so the object T is the same!!!T.TEST_M1 (t);System.out.println ("t.i =" + t.i + "t.j=" + T.J); The}}There is only one answer: Java
);//5,6hello.test1 (hello); System.out.println ("T.I =" + hello.i + "t.j=" + hello.j);//5,6,a and T both point to an object, and in Test_m a points to another object, so the object T is the same!!! hello.test2 (hello); System.out.println ("HELLO.I =" + hello.i + "hello.j=" + hello.j);// the } //A reference is passed, and the representation participates in the argument two references all point to the same object. Public voidtest1 (Hello a) {Hello B=NewHello (); B.I= 1; B.J= 2; A=b; }
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.