Answers for "declare arraylist in class java"

3

arraylist of objects in java

public static void main(String args[]){
	   ArrayList<Dog> doglist= new ArrayList<Dog>();
	  doglist.add(new Dog(“Joe”,”Husky”,3, white));
	  doglist.add(new Student(“Flash”,”German Shepherd",1, brown));
	  doglist.add(new Student(“Jason”,”Pitbull”,5,brown));
}
}
Posted by: Guest on August-19-2021
3

how to make an array of arraylists in java

ArrayList<Integer> [] myList = (ArrayList<Integer>[]) new ArrayList[4];
Posted by: Guest on October-12-2020

Code answers related to "declare arraylist in class java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language