Fill the code where indicated(Student completion), here is the code. public clas
ID: 3556665 • Letter: F
Question
Fill the code where indicated(Student completion), here is the code.
public class ClassA {
private String s1, s2;
private static int numClassA;
//Initializes s1 and s2 and keeps track of the number
//of classA objects created.
public ClassA(String s1, String s2) {
this.s1 = s1;
this.s2 = s2;
++numClassA;
}
//Sets both s1 and s2 to parameter s1 and
//keeps track of the number of ClassA objects created.
public ClassA(String s1){// Student completion
}
/**
* Returns true if s1 equals s2, false otherwise
* @return true if s1 equals s2, false otherwise
*/
public one {// Student completion
}
/**
* STATIC method that returns the number of ClassA
* objects created
* @return the number of ClassA objects created
*/
public numClassA() { // Student compleation
}
public String toString() {
return s1 + ", " + s2;
}
}
Explanation / Answer
public class ClassA {
private String s1, s2;
private static int numClassA;
//Initializes s1 and s2 and keeps track of the number
//of classA objects created.
public ClassA(String s1, String s2) {
this.s1 = s1;
this.s2 = s2;
++numClassA;
}
//Sets both s1 and s2 to parameter s1 and
//keeps track of the number of ClassA objects created.
public ClassA(String s1){// Student completion
this.s1 = s1;
this.s2 = s1;
++numClassA;
}
/**
* Returns true if s1 equals s2, false otherwise
* @return true if s1 equals s2, false otherwise
*/
public bool one(String s1,String s2) {// Student completion
if(s1.equals(s2))return true;
else return false;
}
/**
* STATIC method that returns the number of ClassA
* objects created
* @return the number of ClassA objects created
*/
public int numClassA() { // Student compleation
return numClassA;
}
public String toString() {
return s1 + ", " + s2;
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.