Untitled

mail@pastecode.io avatar
unknown
plain_text
14 days ago
885 B
0
Indexable
Never
import java.util.Vector;

public class VectorExample {
    public static void main(String[] args) {
        
        Vector<Integer> vector = new Vector<>(10);
        vector.add(1);
        vector.add(2);
        vector.add(3);
        System.out.println(vector);
        vector.remove(1);
        System.out.println(vector);
        for (int num : vector) {
            System.out.println(num);
        }
    }
}















public class Main { 
	public static void main(String[] args) 
	{ 
		int a[] = { 1, 8, 3 }; 

		 
		int b[] = new int[a.length]; 

		
		b = a; 

		
		b[0]++; 

		System.out.println("Contents of a[] "); 
		for (int i = 0; i < a.length; i++) 
			System.out.print(a[i] + " "); 

		System.out.println("\n\nContents of b[] "); 
		for (int i = 0; i < b.length; i++) 
			System.out.print(b[i] + " "); 
	} 
}
Leave a Comment