ArrayList.clear()

ArrayList

ArrayList.clear() Delete all elements from the ArrayList.


Examples with output add()
ArrayList<String> languages = new ArrayList<String>();
languages.add("Java");
languages.add("PHP");
languages.add("Python");
System.out.println(languages); //[Java, PHP, Python]

// remove all elements ///
languages.clear();
System.out.println(languages); //[] 

// Add elements to empty ArrayList//
languages.add("Java");	
System.out.println(languages); //[Java]
ArrayList Tutorials


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com



    Post your comments , suggestion , error , requirements etc here




    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2022 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer