Hi all!

Just a brief question. How would i go about adding say the first 5 numbers in an array of 12 preset values?

Thanks :)

How hard it can be? Like this?

public class ArrayTest {

    public static void main(String[] args){
    	int[] a = new int[12];
    	for(int i = 0; i < 5; i++){
    		a[i] = i;
    	}
    	for(int i = 0; i < 5; i++){
    		System.out.println(a[i]);
    	}
    }    
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.