logotransparent.png

Legion of Learners

www.lol-101.com

  • Home

  • Classrooms

  • Courses

  • About Us

    • Executive Team
    • Board Members
  • Resources

  • More

    Use tab to navigate through the menu items.
    To see this working, head to your live site.
    • Categories
    • All Posts
    • My Posts
    kevinzhao183
    Mar 14, 2021

    Intro to Java 3/13/21 Homework

    in Java Question Bank

    Write a program with a method that takes an argument of one int array. It should return a new int array with each value in the new array double that of the value in the old array.

    1 comment
    0
    brendan.yen
    Mar 20, 2021

    import java.util.*; class Main { public static void main(String[] args) { int [] myarray = new int [5]; Scanner x = new Scanner(System.in); for (int i = 0; i < 5; i++){ myarray[i] = x.nextInt(); } System.out.println(Arrays.toString(multiplyby2(myarray))); } public static int [] multiplyby2 (int[] iarray) { int [] myarray2 = new int [iarray.length]; for (int a = 0; a < iarray.length; a++){ myarray2[a] = 2*iarray[a]; } return myarray2; } }

    0
    1 comments

    Questions? Email us at legionoflearners@gmail.com or join our WeChat group!

    • lol-101dotcom

    ©2020 Legion of Learners