a). Write a method called createArray which takes two parameters a and b, and returns an array that has all integer from a to b.   Example 1: a = 6, b = 2 Array is [6, 5, 4, 3, 2] Example 2: a = 4, b = 8 Array is [4, 5, 6, 7, 8] Example 3: a = 4, b = 4 Array is [4]   b). In main method, you should ask the user to input two integers a and b. Then call method createArray and print out the array.         class Main { public static int[] createArray(int a, int b) { } public static void main(String[] args) { } }

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter8: Arrays
Section: Chapter Questions
Problem 20RQ
icon
Related questions
Question
a). Write a method called createArray which takes two parameters a and b, and returns an array that has all integer from a to b.
 
Example 1:
a = 6, b = 2
Array is [6, 5, 4, 3, 2]
Example 2:
a = 4, b = 8
Array is [4, 5, 6, 7, 8]
Example 3:
a = 4, b = 4
Array is [4]
 
b). In main method, you should ask the user to input two integers a and b.
Then call method createArray and print out the array.
 
 
 
 
class Main {

public static int[] createArray(int a, int b) {

}

public static void main(String[] args) {



}
}
 
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Passing Array as Argument
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
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,