3:08 am - Friday April 19, 2019

Vector Example Program for equals(Object o)

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
/**
@AUTHOR: candid java
@DESCRIPTION: coding  for checking the object?s equality
 */

import java.util.*;

public class Equals {
	public static void main(String args[]) {
		Vector v1 = new Vector();// Creating the vector object1
		v1.add("abi");
		v1.add("bala");
		Vector v2 = new Vector();// Creating the vector object1
		v2.add("abi");
		v2.add("bala");
		Vector v3 = new Vector();// Creating the vector object1
		v3.add("sam");
		v3.add("vimal");
		boolean b1 = v1.equals(v2); // checking v1 and v2 object are equal or
									// not
		boolean b2 = v1.equals(v3); // //checking v1 and v3 object are equal or
									// not
		System.out.println("object1 equals object2=" + b1);
		System.out.println("object1 equals object3=" + b2);
	}
}

OUTPUT:
object1 equals object2=true
object1 equals object3=false

Filed in: Z-A All Java Codes

Comments are closed.