edipse workspace Program05/src/multipleMethods/ManyMethodsjava Eclipse File Edit
ID: 3742575 • Letter: E
Question
edipse workspace Program05/src/multipleMethods/ManyMethodsjava Eclipse File Edit Source Refactor Navigate Search Project Run Window Help Quid. Access Package Explorer PracticingArrays.java Ma ManyMethods java string color = JOptionPane . Show!nputoalog("what return number-Integer.parseInt(color) is your favorite color?"); Amays Capstone CreatingMultipleMethods Exam2 grades JavaBasic Lab05 Lab06 Lab10 Lab11 LearningowToUseloops Morelava 34 35 36 public void displayNumber(int number) 37 38 39 48 41 public void fiveNumber() 42 OptionPane.showMessageDialog(null, number); int count 1; int [] numbers new int [5]; 45 46 47 48 49 58 51 52 53 54 for(int n-e; n JRE System Library [JavaSE 9] vmultipleMethods ManyMethods java SlucluredParl2 Console Problems lavadoc Re Declaration Debug E. Outline-Task List cterminated> EntryPoint (21) [lava Application] CAProgram FilesJavare-9.0.1bin'javaw.exe (Sep 3, 2018, 11:22:10 PM) Writablse Smart Insert 49:62 Type here to search 22 PM 9/3/2018Explanation / Answer
Please find the code for the method below :
public void displayFiveNumbers(int[] fiveNumbers){
for(int i = 0; i<5 ; i++){
JOptionPane.showMessage(null, fiveNumbers[i]);
}
}
In java, arrays can be directly passed by reference and accessed in another methods, unlike C where you have to do it using pointers.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.