The fourth weekly summary report of two experiments &

1. Write a class called Rectangle rectangle representing. Attributes which includes a wide width, height, and color of high color, width and height are double-type, and the color is of type String. Requirements class has:

(1) using the constructor completes the initial assignment of each attribute

(2) using the get ... () and set ... () in the form of complete access and modify the properties of

(3) calculate the area of ​​providing getArea () method and the calculated circumference getLength () method

Experiment code:

 

 Unique identification (a combination of characters and numbers 11 lengths) 2. Bank Account account records have an account, user name, date of opening the account password, the current balance (six-digit number that can be used at the beginning 0). Bank of when to open a new account, the bank provides an identifier, the initial account password 123456, customers provide your name, customers can open an account when a deposit for an initial account amount, without providing an initial balance of zero. Definition of the class and ask the class provides the following methods: deposits, withdrawals, change your password, you can query separately identifies an account, name, date of opening, the current balance and other information.

Experiment code:

 

 

 

 The fourth weekly summary:

It introduces the String class

1. String class object instantiated two

Directly to the assigned object class String 1;. 2 and give new stack memory objects;

Contrast difference between the two methods:

1 species is the direct use of an electrolytic cell and given some target Class String;

No. 2 is to copy some objects in the electrolytic cell, open up new space for storage;

Different addresses in two ways, the same content

With reference to the difference between == equals the

== is the comparison address is the same, equals is more content;

Guess you like

Origin www.cnblogs.com/hhwcg/p/11530010.html