Write a class with a main() method. The main() method should declare and initialize four different ArrayLists, each containing at least four int values. The class should also contain a method named fiveEight. Given an ArrayList of ints, the fiveEight should return the int 30 if every element of the given ArrayList is either. a 5 or a 8; otherwise, it should return -9. There should be four calls to the allfiveEight method in the main() method.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter9: Advanced Array Concepts
Section: Chapter Questions
Problem 18RQ
icon
Related questions
Question
In java
Write a class with a main() method. The main() method should declare and initialize four different ArrayLists,
each containing at least four int values. The class should also contain a method named fiveEight.
Given an ArrayList of ints, the fiveEight should return the int 30 if every element of the given ArrayList is either
a 5 or a 8; otherwise, it should return -9. There should be four calls to the allfiveEight method in the main() method.
Transcribed Image Text:In java Write a class with a main() method. The main() method should declare and initialize four different ArrayLists, each containing at least four int values. The class should also contain a method named fiveEight. Given an ArrayList of ints, the fiveEight should return the int 30 if every element of the given ArrayList is either a 5 or a 8; otherwise, it should return -9. There should be four calls to the allfiveEight method in the main() method.
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage