Neha Bhattad

Ranch Hand
+ Follow
since Aug 20, 2007
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Neha Bhattad

I was mainly thinking about deserialization:
in deserialization the superclass(not implementing serialization) should have no-arg constructor else the readObject throws runtime exception.
What if the superclass has a no-arg constructor? Does it fit the bill?

The best way perhaps is to try it out...
My question was because of a solution from K&B master test. It states:
LinkedHashSet provides the fastest iteration through a set where you care about the order in which entries were added.

Also K&B book page 608 states:
HashMap - fastest updates (key/value pairs)
LinkedHashMap - Faster iterations.

Q: If i need a map where I need fast access - is LinkedHashMap the answer?

Hope I am clear in my explanation...
Can a constructor with var-args be used when a no-arg constructor is needed?

Will this work for all cases like when in deserialization the superclass(not implementing serialization) should have no-arg constructor?

Does LinkedHashMap provide faster iteration than HashMap?

From K&B masterexam:

Is this true?
A can be constructed with a instance?

Answer says true.

I know the statement true for "B"ufferedReader. But i marked it as false for the Case. B vs. b.

For example if you try to import - it cant recognise the class. So i think the above statement should be false?
I marked name as non-static and synchronized on 'this'. Now I get 200 X's followed by 200 Y's.
My question is:

Can we be sure to get 200 Z's followed by 200 Y's...?
I think the output is not predictable...please help me understand this.

Somewhat modified:

Since the two threads are working on different instances, they can both acquire the "this" lock for their respective objects.
I think we can get any output:?
Lucky, only the asList() method claims to bind the array and the newly created list.
toArray() does not bind the list and array.
the throw new RuntimeException() is outside of the try block.

Finally will always execute even if an exception is thrown in the try block. In this case exception is outside. So programs stops before it reaches try.
Animal IS-A Animal.

The class will pass the IS-A test for itself.

Hope this helps.
Thanks Al Mamun.

Instead Of Anonymous array use normal array declaration &initialization,u will get expected output.

My question is: Why would the answer be any diffent if it wasnt an Anonymous array? I tried and im getting the same response 0030.

What about Arrays? I think if we pass an array into a method the original reference is not updated in case of arrays the array object is copied into a new object and now there will be 2 objects?
Self Test 6: Question 1

When I run this I get:
0 ><
1 ><
2 >34<
4 ><
5 ><
6 ><

I understand how the other empty strings appear. But why is there a 6th empty string?

The m.start() displays the index right? The indexes are from 0-5, where is the 6th index coming from?
Modified code based on what Jesper said:

The code does not compile on a.process(); since the compiler is expecting the process method os class A to be called and the exception thrown by the method has not been caught.
Can someone please suggest a good link to understand classpath settings?