This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of Software Teaming: A Mob Programming, Whole-Team Approach and have Woody Zuill and Kevin Meadows on-line!
See this thread for details.

nt novel

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

Recent posts by nt novel

Which statement about the getSource() method of an ActionEvent is true?
A It is used to identify a component affected by an action.
B It is used to identify the cause of an action on a component.
C It is used to identify the panel of a component affected by an action.
D It is used to identify the frame of a component affected by an action.

Which is the correct answer above ?
Thanks
As descriptions go...
Objects are available for GC when they are set to null.
I am having difficulty picturising new Long(4) as an Object.
Becasuse...
We cannot refer the Long(4) as an object as you are mentioning...
It has to be thru a reference that u set the value of the object = null...
then how can you set the value of an Object = null;
hope I am clear.. Thanks again
No I havent made any typo..
Unless the answers are themselves typed wrong !!!
Thanks cindy for the expl.
With the above example..
can you identify if there is any Object then !!
or instance of an Object...that is ready for gc.
Thanks v.much.
Appreciate all of your replies...
Just to conclude.. one last question with examples...
class A {
A(int i ) {
System.out.println("in A");
}
}
class B extends A {
B(){
super(2);
}
public static void main (String str[]) {
B b = new B();
A a = new A(2);
}
}

class C extends A {
C(int i){
super(i);
}
public static void main (String s[]) {
C c = new C(2);
A a = new A(2);
}
}

class D extends A {
public static void main (String str[]) {
A a = new A(2);
}
}
Now :
What is the reasoning behind classes B and C compile and Run.
Why not class D???
Isnt D similar to the Color example ?
[This message has been edited by nt novel (edited May 16, 2001).]
Given:
1. public class ThisClass {
2. private String mine = new String("mine");
3. public class ThatClass {
4. public void yourMeth() {
5. //method body
6. }
7. }
8. }
What should you use to instantiate ThatClass from outside its containing class?
A
ThatClass tc = new ThisClass.ThatClass();

B
ThatClass tc = ThatClass.new ThatClass();

C
ThisClass tc = new ThisClass();
ThisClass.ThatClass thc = tc.new ThisClass();

D
ThisClass tc = tc.new ThisClass();
tc.ThatClass thc = new tc.ThatClass();

The Answer given is C.
My argument is the that class is never instantiated... It is only the this class that is instantiated with a ref. to that class....
Any supportive stmts..
Thanks
Neeraj,
Thanks for the effort.
But I have seen examples like
class A {
public A (int i ) { }
}
class B extends A {
A a = new A(2);
}

Now is this correct or incorrect ?
If the answer is Yes >... That is the root of my consfusion.
Where is the default constructor there ???
Thanks again.
As per my undestanding ab is reference to an object. and is eligible for garbage collection.
unless I am missing something very basic.
Thanks.
and as per the above reply.. when return is executed the control shifts to the calling method... it is never in line 9 !!!
again.. unless i am missing something basic.
Thanks

Originally posted by Cindy Glass:
ab is a variable. It is NEVER going to be garbage collected.
The "new Long(3)" object that ab refered to for a while is eligible for the gc() at line 9 when the method is over and the arrays that are local to the method get destroyed, so there are no more references to the Long(3) object.
Of course in this method you are always going to return null.


Let me be more specific.
In a class when I have a constructor with a parameter.
I have seen examples where they dont explicitly define the default constructor i.e, with no params.
In some cases I see a question.. where the answer would be no default constructor is define and hence a compiler error is generated...
Hope i am clear this time.
Thanks for the answer.
I mean in such case when

Originally posted by nt novel:
Hi all,
I am a bit confused on this topic and it may be a bit too general but ..
When do you need to define the no parameter constructor explicitly ?
When dont you need to ?
Thanks,
nt



1. public class Garbage {
2. public static Object getIt() {
3. Object ab = new Long(3);
4. Object cd[][] = new Object[1][2];
5. cd[0][1] = ab;
6. cd[0][0] = ab;
7. ab = null;
8. return ab;
9. }
10. }

My question is :
when is ab ready for garbage collection ?
is it line 7, 8 or after 8 !!!
Thanks
Hi all,
I am a bit confused on this topic and it may be a bit too general but ..
When do you need to define the no parameter constructor explicitly ?
When dont you need to ?
Thanks,
nt
" Congrats Faisal "
21 years ago
"Good luck to you Faisal. "
Let me know how you do your exam. and your exp.
Good luck again.
nt.
21 years ago
Can you send that notes of Velumurgan !!
Thanks aln@cyberspace.org

Originally posted by akbar thobani:
well finally passed...thanks a lot to every one who contribute to this forum. some thoughts regarding test....this what i got:
* about 6 - 7 question related to constructor file I/O
* about 3 - 4 thread question long and confusing
* definitly know all about passing reference all types of references, about, 4 - 5 question in different forms.
* lot of questions about fundamental.
* one question where I am sure all the given choices were wrong.
* no gridbaglayout only one or two on awt and events
* 4 - 5 questions on inner classes.
thats all I can think of for now...I was getting 70 - 73% on JQplus last day, and thats what I got on test.
once again thanks a lot to every one, for your posting it definitly helped me a lot. Also my personal thanks to "Velmurugan" for his notes, they were great.


21 years ago