• Add a Comment
  • Edit
  • More Actions v
  • Quarantine this Entry

Comments (3)

1 Data_t commented Permalink

This is a useful information.

2 Data_t commented Permalink

Debug Tip:

 
Traditionally the for loop is engaged for printing contents of an Array,But starting Java 5 it has been made simple.The java.util.Arrays does the trick.
Here is a simple java program exercising the Java.util.Arrays.toString function to print the contents of an Array:
 
import java.util.Arrays;
class HW {
public static void main(String args[]){
String[] test = {"a,b,c,d,e"};
System.out.println("test[]"+Arrays.toString(test));
int[] test2 = {1,2,3,4};
System.out.println("test2[]"+Arrays.toString(test2));
}
}
 
Output
bash-3.2$ sdk/bin/javac HW.java
bash-3.2$ sdk/jre/bin/java HW
test[][a,b,c,d,e]
test2[][1, 2, 3, 4]

3 code2learn commented Permalink

Data_t thanx for the information.

 
To follow Code2Learn you can view :
 
http://code2learn.com
 
http://facebook.com/code2learn

Add a Comment Add a Comment