Monday, March 5, 2012

Analyse the Tech Mahindra Experience Programs

-----------------------------------------------1-------------------------------------------------------
class Person{
String ss;
Person(String s)
{
ss=s;
}
}

public class TechMahindra1 {
public static void main(String[] args) {
Person p1=new Person("nag");
Person p2=new Person("nag");
if(p1.equals(p2))
System.out.println("true");
else
System.out.println("false");


}

}

--------------------------------------------------2----------------------------------------------------------

public class TechMahindra2 {
public static void main(String[] args) {

if("a".toUpperCase().equals("A"))
System.out.println("true");
else
System.out.println("false");



}

}

---------------------------------------------------------3------------------------------------------------------



public class TechMahindra3 {
String n;
public TechMahindra3(String name) {

// TODO Auto-generated constructor stub
n=name;
}
public static void main(String[] args) {
TechMahindra3 t=new TechMahindra3("nag");
System.out.println(t.toString());



}


}

-----------------------------------------------------------4-----------------------------------------------------------


import java.util.HashSet;
import java.util.TreeMap;

public class TechMahindra4 {
public static void main(String[] args) {

HashSet t=new HashSet();

for(int i=0;i<=5;i++){
t.add(i);
}

for (Object object : t) {
System.out.println(object);

}

}



}

------------------------------------------------------------5----------------------------------------------------------

import java.util.HashMap;

public class TechMahindra5 {
public static void main(String[] args) {
HashMap hm=new HashMap();
hm.put("key","nag");
hm.put("key","raj");
System.out.println(hm.get("key"));
}
}

----------------------------------------------------------------6------------------------------------------------------
public class TechMahindra6 {
public static void main(String[] args) {
Integer i=new Integer(1);
int y=1;
if(i==y)
System.out.println("true");
else
System.out.println("false");
}

}






No comments:

Post a Comment

Thank you for your comment