murali


{ City }
< Country > india
* Profession *
User No # 37048
Total Questions Posted # 0
Total Answers Posted # 7

Total Answers Posted for My Questions # 0
Total Views for My Questions # 0

Users Marked my Answers as Correct # 54
Users Marked my Answers as Wrong # 12
Questions / { murali }
Questions Answers Category Views Company eMail




Answers / { murali }

Question { Aricent, 7344 }

Q) I have a ArrayList object, in that object i have added 5
integer values, 5 float values, 5 string values. Now
question is how can delete particular type of data ( i.e all
int values or all float values or string values) in that
list object at a time?


Answer

for(int i=0;i if(arr.get(i) instanceof Integer)
arr.remove(i);
}

Is This Answer Correct ?    5 Yes 4 No

Question { Aricent, 12849 }

I have a Arraylist object, it has duplecate values also. Now
question is i want delete duplecate data in that objet with
out using Set?


Answer

solution without taking time complexity into account

List arr = new ArrayList();
for(int i=0;i for(int j=i+1;j if(arr.get(i)!=null && arr.get(i).equals(arr.get(j))){
arr.set(j, null);
}

}
}

while(arr.contains(null))
arr.remove(null);

Is This Answer Correct ?    2 Yes 5 No


Question { 2243 }

write a class to input 2 points by the user & check the line
maked by the points is horizontal,vertical or rectangle?


Answer

if (x1,y1) and (x2,y2) are two points..then line made is horizontal if (y1==y2).vertical if(x1==x2).Two points can never form a rectangle.

Is This Answer Correct ?    1 Yes 0 No

Question { Oracle, 15584 }

I have one POJO class(Java bean class), it has two
variables for that it has setters and getters. Now i have
created two objects for that class and i have set the data
for those variables through this two objects. Now question
is i want check whether those two objects have same data or
not, for this write a program? Thanks, Bose.


Answer

override equals method from object class and have the comparison logic inside that.Also override hashcode method..
Now pBeanOne.equals(pBeanTwo) will give you the result

Is This Answer Correct ?    13 Yes 0 No

Question { 5520 }

Sample code to retrieve objects from HashMap in sorted
ascending order?


Answer

Map hm = new HashMap();
//add values to hashmap
Map tm = new TreeMap(hm);
//Iterate keySet in tm

Is This Answer Correct ?    9 Yes 2 No

Question { 4258 }

Consider that class classA, abstract class classB, and
final classC have been defined.Which one of the following
is correct?
1. classA extends classC implements classB
2. class A extends classB, classC
3. classA extends classB
4. classB implements classC


Answer

3. classA extends classB

Is This Answer Correct ?    8 Yes 0 No

Question { SunGard, 9411 }

Can u write constructor in abstract.If yes den when it will
be invoked.


Answer

yes..it will be invoked when the child class extending the abstract class is instantiated

Is This Answer Correct ?    16 Yes 1 No