I am trying to write some programs to answer the questions at the bottom of these descriptions of classes.
I have downloaded a class that has two attributes, all of the type int, and four methods. (attribute1 & attribute2) The class has two constructors. The first constructor receives no parameters, and assigns certain fixed initial values to the attributes. The second constructor receives a double as a parameter. It too assigns values to the attributes, but not necessarily the same values as assigned by the first constructor.
The four methods are described as:
method1 This method takes no parameters, and returns the value of attribute1.
method2 This method takes an int as a parameter, and returns the value of this parameter added to attribute2.
method3 There are two versions of this method. The first version takes one parameter, an int. The second also takes one parameter, a char. Neither versions return a value.
method4 This method takes no parameters, and returns an array of Strings. Every element in the array is filled.
Questions 1. What is the initial value of attribute1 when an object is created using the first constructor?
2. What is the initial value of attribute2 when an object is created using the first constructor?
3. What is the initial value of attribute1 when an object is created using the second constructor?
4. What is the initial value of attribute2 when an object is created using the second constructor?
5. What happens when you call method3 with an int as parameter?
6. What happens when you call method3 with a char as parameter?
7. What is the length of the array returned by method4?
How can I read a programmer's mind? Your teachetr obviously expects you to actually run the program to get these answers. There is no way to tell you which values the attributes have or what the methods do, since we don't have the program.
I know you are too lazy to do your homework, but at least try to actually read the questions before posting them here. You would have saved some time then.