arraylist printing error can some suggest a solution -
i need print arraylist can help. changed normal double double still not work please help.
import java.util.*;
public class heights {
static arraylist <double> heights = new arraylist <double>(); public static void main(string[] args) { //use use method addsomeheight(5.1); addsomeheight(6.2); addsomeheight(6.3); addsomeheight(5.4); addsomeheight(5.5); addsomeheight(5.6); addsomeheight(5.7); addsomeheight(5.8); addsomeheight(5.9); addsomeheight(6.9); //declare new method } private static void addsomeheight(double x) { (double x1 : heights){ system.out.println(x1); } } }
you're not adding value list, it's empty. method addsomeheight()
doesn't add argument list. ignores it, , prints list instead.
please respect java naming conventions: variables start lowercase letter, , methods camelcased.
Comments
Post a Comment