Question: Create Array Create a method createArray ( ) that accepts five String parameters Create an Array of String that stores the value of the five

Create Array
Create a method createArray
()
that accepts five String parameters
Create an Array of String that stores the value of the five parameters.
return the newly created array.
import java.io
.
*
;
import java.util.
*
;
import java.text.
*
;
import java.math.
*
;
import java.util.regex.
*
;
public class ProgrammingLanguages
{
//
Write your static method here
/*****
DO NOT CHANGE THE CODE BELOW THIS LINE
*****/
public static void main
(
String
[]
args
){
Scanner in
=
new Scanner
(
System
.
in
)
;
String lang
1
,
lang
2
,
lang
3
,
lang
4
,
lang
5
;
lang
1
=
in
.
next
()
;
lang
2
=
in
.
next
()
;
lang
3
=
in
.
next
()
;
lang
4
=
in
.
next
()
;
lang
5
=
in
.
next
()
;
String
[]
mainArray
=
createArray
(
lang
1
,
lang
2
,
lang
3
,
lang
4
,
lang
5)
;
//
Loop through the array and print each element
for
(
String language : mainArray
){
System.out.println
(
language
)
;
}
}//
end of main
()
}//
end of ProgrammingLanguages class
Expected STDOUT
Java
JavaScript
Python
Ruby

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!