Gunjaan Agarwal

Greenhorn
+ Follow
since Jun 07, 2006
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 Gunjaan Agarwal

it will print null amit.Does not give a exception.An exception occurs when u don initaialize it.However if it was a instance var n not local u need not initialize it as instance var are automatically initialized.
its not a local variable..its an instance variable..compilation error is coz no class instance is used to access s
gives u compilation error as non-static field is being accessed in static method
How is String passed in method call(ref or value)??
Kindly explain me the below program output


public class Test{

public static void main(String [] args) {
String textString = new String ("java");
StringBuffer textBuffer = new StringBuffer ("java");
stringReplace (textString);
bufferReplace (textBuffer);
System.out.println (textString + textBuffer);
}

public static void stringReplace (String text) {
text = text.replace ('j' , 'i');
//System.out.println(text);
}

public static void bufferReplace (StringBuffer text) {
text = text.append ("C");
//System.out.println(text);

}

}

output is javajavac
Given that b and c refer to instances of wrapper classes, which two statements are
true? (Choose two)
A. b.equals(b) returns true.
B. b.equals(c) returns the same result as b == c.
C. b.eqials(c) can return false even if c.equals(b) returns true.
D. b.equals(c) throws an exception if b and c are different wrapper types.
E. b.equals(c) returns false if the type of wrapper objects being compared are
different.
but even line 2 is never reachable...can u explain me y tats not the answer
but even line 2 is never reachable...can u explain me y tats not the answer
but even line 14 is unreachable code..as my program line 2
public class Test {

public void foo() {
1 assert false;
2 assert false;
}

public void bar(){
while(true){
3 assert false;
}
4 assert false;
}

}


What causes compilation to fail?

i have named the stmt..let me know the answer with explaination
thanks ya but this link talks abt static classes as far as i understood...but wat abt classes with static members tat are references to other objects.
Are static members garbage collected as we say them as "live objects"...if they are when are they garbage collected(if the static member itself holds a reference to an object)