11:16 am - Tuesday October 24, 2017

HashSet example program for boolean isEmpty()

CANDID INDUSTRIAL TRAINING -- CHENNAI
Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044
/**
@Description : HashSet example program for boolean isEmpty()
@Author : candidjava.com
 */

import java.util.HashSet;

public class hshst {
	public static void main(String[] arg) {
		HashSet newset = new HashSet();
		newset.add("Hai");
		newset.add("idiot");
		newset.add("Bye");
		boolean isempty = newset.isEmpty();
		System.out.println("Is the HashSet empty ?: " + isempty);
	}
}

Output

Is the hash set empty: false

BACK

Filed in: Z-A All Java Codes

Comments are closed.