Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Seff_Test 1) What happens if you do not write a constructor method for a class?

ID: 3562792 • Letter: S

Question

Seff_Test

1) What happens if you do not write a constructor method for a class?

2) Do the following two methods have the same signature or different signatures?

public int methodA(int x)

public float methodA(int y)

3) Do the following two methods have the same signature or different signatures?

public float methodA(int x, float y)

public float methodA(int y)

4) Do the following two methods have the same signature or different signatures?

private int methodA(int x)

public int methodA(int y)

5) Do the following two methods have the same signature or different signatures?

public int methodA(int x, char sym)

public int methodA(int y)

6) What is the term for two or more methods in the same class definition file having the same name but different signatures?

7) What is the purpose of the StringBuilder class?

8) What does immutable mean

9) How many versions of a constructor can a class have?

a) At most 1

b) At most 2

c) At most 3

d) As many as wanted, as long as the parameter lists are different

10) Name one method of the String class that is overloaded.

Explanation / Answer

1) What happens if you do not write a constructor method for a class?
Java create one for your class.
2) Do the following two methods have the same signature or different signatures?
public int methodA(int x)
public float methodA(int y)
same
3) Do the following two methods have the same signature or different signatures?
public float methodA(int x, float y)
public float methodA(int y)
different
4) Do the following two methods have the same signature or different signatures?
private int methodA(int x)
public int methodA(int y)
same
5) Do the following two methods have the same signature or different signatures?
public int methodA(int x, char sym)
public int methodA(int y)
different
6) What is the term for two or more methods in the same class definition file having the same name but different signatures?
overloading
7) What is the purpose of the StringBuilder class?
to do string opertions becuase String is immutable in java.
8) What does immutable mean
object cant be changed at run time.
9) How many versions of a constructor can a class have?
d) As many as wanted, as long as the parameter lists are different
10) Name one method of the String class that is overloaded.
indexOf