Please answer queston 3. use java thanks. 3. Write a method prototype (without b
ID: 3802577 • Letter: P
Question
Please answer queston 3. use java thanks.
3. Write a method prototype (without body) named calculateAllDataPoints that takes an array double and returns a Boolean value. This method should be accessible only to current class and its subclass.
4. What is the value of localName, localCategories[0], localCategories[1], and localCategories[2] after both clearName and clearCategory are called?
import java.util.Arrays; public class Exam1 { private String[] categories; public void clearName( String name ) { name = “”; } public void clearCategory( String[] categories ) { Arrays.fill( categories, “a”); } public static void main(String[] args) { String localName = “Kyle”; String[] localCategories = {“desktop”, “laptop”, “tablet”}; Exam1 myObj = new Exam1(); myObj.clearName( localName ); myObj.clearCategory( localCategories ); } }
Explanation / Answer
3) protected boolean calculateAllDataPoints(double arr[]) ;
If we specified the access specifier as protected then only the current class and its subclass will only can access that method.
4)the value of localName="Kyle";
the value of localCategories[0] ="a";
the value of localCategories[1] ="a";
the value of localCategories[2] ="a";
after both clearName and clearCategory are called.
the value of localCategories[0] ="a";