Answer to Question #313121 in Java | JSP | JSF for Malibu Nights

Question #313121

Why does the new ArrayList() in my code errors. I don't get It. Can someone help me, its really urgent. Thanks

public static ArrayList<String> sub = new ArrayList();

public static ArrayList<String> subCourse = new ArrayList();


1
Expert's answer
2022-03-17T09:37:27-0400
class Main
{
    public static ArrayList<String> sub = new ArrayList();

    public static ArrayList<String> subCourse = new ArrayList();

    public static void main (String[] args) {
        Main.sub.add("the");
        System.out.println(Main.sub.get(0));
    }
}


It seems that it works good.


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS