interview question
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
i found someone...
can you pls give me the detail answer of each...
I didn't understand thier answer thats why posting here..
Q1. What comes to mind when someone mentions a shallow copy in Java?
A. Object cloning.
???
Q2. How can you minimize the need of garbage collection and make the memory use more effective?
A. Use object pooling and weak object references.
Q3. What comes to mind when you hear about a young generation in Java?
A. Garbage collection.
Q4. You can create an abstract class that contains only abstract methods. On the other hand, you can create an interface that declares the same methods. So can you use abstract classes instead of interfaces?
A. Sometimes. But your class may be a descendent of another class and in this case the interface is your only option.
Thanks and Regards, Amit Taneja
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
i will give ans to u r 1st question
what is mean by shallow copy
it is funda of object serialization and cloninig
u might know what is mean by cloaning most of the time we want to create
copy of object which has same initial state in that case we are using cloaning
class has attributes and properties
whereas object has state and behaviour
instance variables might be primitive or non primitive
when we clone object of class which has non primitive variables only
reference get copied not actual object
this is known as shallow copy
i think u get more accurate and ans in graphical form in Head first java
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
try to create anonymus object
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Taken From: amit taneja
Q2. How can you minimize the need of garbage collection and make the memory use more effective?
A. weak object references.
Check this good link for java object references.
http://www.ociweb.com/jnb/archive/jnbJune2000.html
Taken From: amit taneja
Q3. What comes to mind when you hear about a young generation in Java?
A. Garbage collection.
The allocated objects are divided in generations according to their ages, and young generations are checked more often than the older ones. On young generation fill up the objects will be moved up to old generation and permanent generations.
Also you can decide on young generation partitions and sizes with
-XX:NewSize
-XX:MaxNewSize
-XX:NewRatio
-XX:SurvivorRatio
HTH,
Arjun.
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
actually i am also looking for diff types of reference
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
A shallow copy clones an instance's instance variables. So when copying an instance of Aaa, the values of i, f, and c would be duplicated. That's what you would expect for the primitives i and f, but what's happening with c, which is a reference? Since c is duplicated, the copy points to the same Color object as the original.
Often that's what you want, and when that's the case you can use the version of clone() that you inherit from Object(). But you might want to use a clone of the Color object, instead of referencing the original. (This would happen when you want to modify the clone, without affecting the original.) In this case you're on your own: you have to override clone().
Consultant to SCJP team.<br />Co-designer of SCJD exam.<br />Co-author of "Complete Java 2 Certification Study Guide".<br />Author of "Ground-Up Java".
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
one question from a not-so-native english speaker:
hi
i will give ans to u r 1st question
what is mean by shallow copy
it is funda of object serialization and cloninig
u might know what is mean by cloaning most of the time we want to create
copy of object which has same initial state in that case we are using cloaning
class has attributes and properties
whereas object has state and behaviour
instance variables might be primitive or non primitive
when we clone object of class which has non primitive variables only
reference get copied not actual object
this is known as shallow copy
can we try to stick a bit with the english we all learned at school? answers like this add an additional level of difficulty for me, this sort of acronym-morse-style is really really hard to understand. at least for me ;-)
would be very very nice & cool,
greetings from germany,
jan
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
i regret it 's my mistake from next time onward i will try to post topics not in shortforms.
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Originally posted by Arjun K:
The allocated objects are divided in generations according to their ages, and young generations are checked more often than the older ones. On young generation fill up the objects will be moved up to old generation and permanent generations.
Also you can decide on young generation partitions and sizes with
-XX:NewSize
-XX:MaxNewSize
-XX:NewRatio
-XX:SurvivorRatio
HTH,
Arjun.
didn't get it what do u mean by this ??

Thanks and Regards, Amit Taneja
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Originally posted by amit taneja:
didn't get it what do u mean by this ??
i'm not really sure what you meant, since parsing non-standard english can be a treacherous and difficult job — this is only my third language, after all. but i think the person you were quoting was talking about certain features of a generational garbage collector, such as the one used by Sun's JVM.
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
"In theory, there is no difference between theory and practice. But, in practice, there is."<br /> - Jan L.A. van de Snepscheut
| Crusading Chameleon likes the size of this ad: Paul Wheaton's 16th Kickstarter: Gardening playing cards for gardeners and homesteaders https://coderanch.com/t/889615/Paul-Wheaton-Kickstarter-Gardening-playing |







