*
* * *
* * * * *
* * *
*
The input data: 1 2 3 4 5-6, using a one-dimensional array output: - 1-2 3 4 5 6,
Reading program to answer the question:
01//app9_2, call the superclass in particular constructor
02 class CCircle//define the superclass CCircle
03 {
04 private double PI=3.14;
05 private double radius;
06
07 public CCircle () {
The euro System. The out. Println (" CCircle () constructor called ");
09}
10 public CCircle (double r) {
11 System. Out. Println (" CCircle (double r) constructor called ");
The radius of 12=r;
13}
14 public void show () {
15 System. Out. Println (radius, "area=" + PI * * radius);
16}
17}
A class of 18 CCoin extends CCircle
19 {
20 private int value;
21 public CCoin () {
22 System. Out. Println (" CCoin () constructor called ");
23}
24 public CCoin (double r, int v) {
25 super (r);
26 value=https://bbs.csdn.net/topics/v;
27 System. Out. Println (" CCoin (double r, int v) constructor called ");
28}
29}
30
31 public class app9_2
32 {
33 public static void main (String args [])
34 {
35 CCoin coin1=new CCoin ();
36 CCoin coin2=new CCoin (2.5, 10);
37 coin1 show ();
38 coin2. The show ();
39}
40}
Answer this question:
1. The program has several class, what is the name of the class?
2. For the constructor in the program, if you have written,
3. That is the instance variables and instance methods?
4. Which statement is called which of the parent class constructor,
5. Write a program to run as a result,
6. The constructor execution time is what?
CodePudding user response:
Don't write homework!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!CodePudding user response:
If you are a student, you can attempt to write it, pretty simple, also can improve their understanding of the code,,