At Westonci.ca, we provide clear, reliable answers to all your questions. Join our vibrant community and get the solutions you need. Join our platform to connect with experts ready to provide detailed answers to your questions in various areas. Our platform offers a seamless experience for finding reliable answers from a network of knowledgeable professionals.
Sagot :
The call makeSentence(3, false) will return
"Object is not very very very regular"
The program fragment is:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
private String descriptor;
public String makeSentence(int quant, boolean sign) {
String s = "Object is ";
if (! sign) {
s += "not ";
}
for (int i = 0; i < quant; i++) {
s += "very ";
}
return s + descriptor;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
descriptor is an instance field of the class. When makeSentence(3, false) is called, it does the following;
Initializes a local variable s with "Object is "
s now contains "Object is "
Since sign== false, the if block executes
s now contains "Object is not "
The for loop will execute 3 times to append "very " to s
s now contains "Object is not very very very "
Finally the return statement returns a concatenation of the contents of descriptor (descriptor=="regular") and s
s now contains "Object is not very very very regular"
Learn more about programs here: https://brainly.com/question/19625875
Thank you for your visit. We're committed to providing you with the best information available. Return anytime for more. We hope our answers were useful. Return anytime for more information and answers to any other questions you have. Westonci.ca is your go-to source for reliable answers. Return soon for more expert insights.