Java study Note 1: "Reference" of an object"

Source: Internet
Author: User
Finally, you can start to learn the Java programming basics in the course and in the gap with Linux. Today is the first section. Code :

Class Number {
Int I;
}

Public   Class Lession5 {
Public   Static   Void Main (string [] ARGs)
{
Number N1
=   New Number ();
Number N2
=   New Number ();
N1. I
= 9 ;
N2. I
= 47 ;
System. Out. println (
" 1: n1.1 = " + N1. I + " , N2. I = " + N2. I );
N1
= N2;
System. Out. println (
" 2: n1. I = " + N1. I + " , N2. I = " + N2. I );
N1. I
= 27 ;
System. Out. println (
" 3. n1. I = " + N1. I + " , N2. I = " + N2. I );
}
}

What is the result? Let's take a look at it and see if you're right ,??? (W)Answer
D: \ L \ learn \ Java \ ZYF > Java lession5
1 : N1. 1 = 9 , N2. I =   47
2 : N1. I = 47 , N2. I =   47
3 . N1. I = 27 , N2. I =   27

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.