Answer:
public ArrayList onlyBlue(String[] clothes){
ArrayList<String> blueCloths = new ArrayList<>();
for(int i =0; i<clothes.length; i++){
if(clothes[i].equalsIgnoreCase("blue")){
blueCloths.add(clothes[i]);
}
}
return blueCloths;
}
Explanation:
- Create the method to accept an Array object of type String representing colors with a return type of an ArrayList
- Within the method body, create and initialize an Arraylist
- Use a for loop to iterate the Array of cloths.
- Use an if statement within the for loop to check if item equals blue and add to the Arraylist.
- Finally return the arrayList to the caller
! actually it means not, which reverses a boolean.
Answer
???
Explanation:
Was this a school question?
Answer:
Option (A) int expressions are always computed exactly; but float expressions can suffer round-off error.
Explanation:
Round - Off Error can be defined as the digital computers have limitations on denoting the decimal numbers, due to this the floating point numbers have to be rounded off or even it is represented exactly after the calculation on the numbers the resulting number has to be adjusted / rounded off according to the specified precision. The resulted number has to be rounded off back to the required precision, this leads to the round off errors in digital computers. As integers don't need to go through the rounding off in computers, the integer numbers don't have round off errors, only floating point numbers have round off errors. So, options (B) , (C) and (D) are false.