Advertisement
icabit

array example

Jun 26th, 2011
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. import java.io.*;
  2. public class arg
  3. {
  4. static BufferedReader in = new BufferedReader (new InputStreamReader(System.in));
  5. public static void main(String args []) throws IOException
  6. {
  7. System.out.print("enter size of array: ");
  8. int x= 0;
  9. x=Integer.parseInt(in.readLine());
  10. String [] n= new String [x];
  11.  
  12. for(int y=0;y<x;y++)
  13. {
  14. System.out.print("name #"+(y+1)+": ");
  15. n[y]=in.readLine();
  16. }
  17. System.out.println("**************************");
  18. for(int z=0;z<x;z++)
  19. {
  20. System.out.println("name #"+(z+1)+": "+(n[z]));
  21. }
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement