Created
August 6, 2019 04:20
-
-
Save paulolorenzobasilio/a917444bf3617c588bb5a5419500a96c to your computer and use it in GitHub Desktop.
Example of output argument in Java. See this for more details https://www.quora.com/What-is-an-example-of-output-arguments-in-Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class OutputArgument | |
{ | |
public static void main (String[]args) | |
{ | |
int[] source = { 1, 2, 3, 4, 5, 6 }; | |
int[] destination = new int[6]; | |
copyFromSourceToDestination (source, destination); | |
for (int i = 0; i < source.length; i++) { | |
System.out.println (destination[i]); | |
} | |
//Outputs 1 2 3 4 5 | |
} | |
public static void copyFromSourceToDestination (int[]source, int[]destination) { | |
for (int i = 0; i < source.length; i++) { | |
destination[i] = source[i]; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment