Created
October 25, 2015 08:14
-
-
Save edinak1/5339005817176ada6491 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| package masiv; | |
| public class PrintArray { | |
| public static void main(String[] args) { | |
| int [] data={1,10,5,7,6}; | |
| int [] data1={0}; | |
| int [] data2={}; | |
| int [] data3={0,0,15,25,16}; | |
| int [] data4={-3,25,2}; | |
| printArray(data ); | |
| printArray(data1); | |
| printArray(data2); | |
| printArray(data3); | |
| printArray(data4); | |
| } | |
| static void printArray(int[]data) | |
| { | |
| if(data==null) | |
| return; | |
| int i=0; | |
| System.out.print("["); | |
| while(i!=data.length) | |
| { | |
| System.out.print(data[i]); | |
| i++; | |
| if(i<data.length) | |
| System.out.print(","); | |
| } | |
| System.out.println("]"); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment