Pramila Chinguru

Ranch Hand
+ Follow
since May 05, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Pramila Chinguru

Hi,
I worked in Oracle 9i for some time and would like to take a certification exam. For oracle PL/SQL developer certification, do we need to appear for two exams "Introduction to Oracle: SQL� and PL/SQL"(1Z0-001)
as well as "Program with PL/SQL"(1Z0-147)?
I look forward to join a group for oracle certification for clarifying doubts. Is there any group like SCJP here for Oracle as well?
Thanks in advance
18 years ago
This is from Khalid's mock exam.

Which one evaluates all the operands? select two correct choices.

1. +
2. &&
3. ?:
4. ||
5. %
1. Can a native method be declared as abstract?
Ans: compile error.

2. Can a native method be delcared as Synchronized?
Ans: Yes

Since native methods have implementation in another language, how could a native method be synchronized since synchronized is implementation specific modifier?
If we want to sort objects in different ways, for eg:
1. sort the string objects in TreeSet using alphabetical order
2. sort the string objects in the same TreeSet using case insensitive alphabetical order
then objects in the same TreeSet can't have different implementation to same compareTo method. hence we do use comparator for second way of sorting.

The point which is bugging me is why can't the TreeSet/Map take comparable interface itself as the parameter in constructor ? what's the need to have comparator interface separately?
class NameComparator implements Comparator{ // rest code}


Here also we need to modify(override/implement) compare method of comparator interface.
My doubt is instead of implementing comparator interface, can we implement comparable interface itself and modify(override) compareTo method for doing the above functionality.

just like
class NameComparator implements Comparable{

int compareTo(Object obj){
//applicable comparison.
}
}

which would be called by default for TreeSet and TreeMap without having to implement comparator interface.

and second one, since we are able to do comparison by changing compareTo method itself, what is the additional advantage of comparator interface over comparable interface?

Originally posted by Naseem Khan:

The advantage which Comparator give sover Comparable is you can sort the same collection in n no. of ways by passing different comparators in each case.


Naseem



Can we implement comparable interface and override compareTo method to provide different ways of comparing objects other than natural ordering? then wouldn't it be the same kind of service provided by comparator?
The elements in TreeSet/TreeMap should implement comparable i/f by default.

Should they implement either comparable or comparator interface?
What is the difference(or relation) between comparator and comparable interfaces?
As far as I know comparable i/f has compareTo method and this method implements natural order of objects, where as comparator contains compare method and comparing of objects can be dictated.
Why is the static Initializer block of B running before that of A?
Does B.f() make static Initializer block of B to complete first and then resumes the execution of satic Initializer in A?
[ June 30, 2006: Message edited by: pramila ch ]
There is a Number class in java.lang package which is abstract and all numeric wrapper types(Byte,Integer,Short, Long, Double, Float) extend from Number class.
[ June 28, 2006: Message edited by: pramila ch ]
I am in need of mock exams for 1.4 version.
These are the links given in mock exam list http://www.javaranch.com/mock.jsp

1. Robert, Heller, & Ernest's Practice Questions
page can't be found in sun site
2. Jamie Jaworski's Certification Exam Preparation
getting redirected to http://ads.adflight.com/go_3p.asp?asid=15227
3. 4 Mock Exams
same as above,after selecting the questions links.

I am using IE version 6.0.
Please let me know how to get these questions.

Thanks,
Which of the following will definitely stop a thread from executing
1. wait
2. notify
3.yield
4.suspend
5.sleep


Ans: 1 3 4 5


Does yield definitely stop executing? Incase there are no high priority threads in ready state, the same thread continues to run. how is yield a correct answer to this question?
How to run Jxam application provided in . Mock Exams

Link on the left is going to Toddler Clothes and deals page.

I downloaded the zip file from the "comments" section. Need help in running it.

Thanks