Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

arrays in constructor java


//To allocate an integer array which all elements are initialized to zero, write this in the constructor:

data = new int[3];
//To allocate an integer array which has other initial values, put this code in the constructor:

int[] temp = {2, 3, 7};
data = temp;
 
PREVIOUS NEXT
Tagged: #arrays #constructor #java
ADD COMMENT
Topic
Name
7+8 =