neelam samnani

+ Follow
since Mar 12, 2001
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 neelam samnani

Is this program will suceesfully compile and run? If it so then tell me why? & If not so then also tell me why?
According to me it should sucessfully complie and run . But it is showing error(java.lang.ClassCastException)during runtime.
Why it is so? While we are defining it cast .
class Base {}
class Sub extends Base {}
class Sub2 extends Base {}
public class CEx{
public static void main(String argv[]){
Base b=new Base();
Sub s=(Sub) b;
} me.
21 years ago
class Loop {
public static void main( String [] agrs) {
int x=0; int y=0;
outer: for (x=0; x<100;x++) {
middle: for (y=0;y<100;y++) {
System.out.println("x=" + x + "; y=" + y);
if (y==10) { <<<

>>> } } }
} //main
} //class
The question is which code must replace the <<>> to finish the outerloop?
continue middle;

a) break outer;
b) break middle;
c) continue outer;
d) none of these...
Pls. suggest me.What is the right answer?

21 years ago

Originally posted by Manfred Leonhardt:
Hi Neelam,
Immutable means that it can't be changed once created. That means that if we have the following:
String s1 = new String( "First" );
The string object "First" can never be changed. I can however change the reference object s1 to point to another string.
s1 += " One";
The object s1 will now point to a string: "First One".
The string "First" will probably be garbage collected by JVM because no references to it exist!
On the other hand, using StringBuffer we can actually change the object contents that the stringbuffer references.
StringBuffer sb = new StringBuffer("First");
sb.append(" One");
Now we no longer have a stringbuffer containing "First" we only have a stringbuffer "First One". In other words, we have changed the string buffer contents.
Immutable --> contents can not be changed
Mutable --> contents can be changed

Sir, Actually , I want to what is there in Java or JVM to make string immutable and stringbuffer mutable? Can you help me?
I 'll very greatfull to You.
21 years ago
I want to know know that what is the basic concept of String and StringBuffer?
Why string is called immutable and String Buffer called mutable?
21 years ago
I got in trouble with "this " , Why this program is not giving compilation error, that "this " is undefined variable.

public class Test {
static int total = 10;
public static void main (String args []) {
new Test();
public void Test () {
System.out.println("In test");
int temp =;
if (temp > 5) {
Pls. help me.
21 years ago
Thanks Jane Griscti to helping me in such a good way.
21 years ago
A mock test which is cretaed by Marcus Green had asked
What will be output by the following code?
public class MyFor{
public static void main(String argv[]){
int i;
int j;
for (i=1;i <3;i++)
for(j=1; j<3; j++) {
if (j==2)
continue outer;
System.out.println("Value for i=" + i + " Value for j=" +j);

According to me answer will be "Value for i =1
Value for j=1 " , but he had answered "Value for i =1 value for j=1 And Value for i =2 , Value for j=1".

I m unable to understand that how can be value of j is remain unchanged while i's value is increasing.
I am not getting it, how it is working?
Pls. anyone can suggest me I 'll be very gratefull to them.
21 years ago
In one of the test paper i read this question, and unable to understand it , whether comlier will print the statement "Before start method" or not . 'coz when i m compling this code i m getting complirt error.?
Pls. suggest me right answer.

1: public class Q1 extends Thread
2: {
3: public void run()
4: {
5: System.out.println("Before start method");
6: this.stop();
7: System.out.println("After stop method");
8: }
10: public static void main(String[] args)
11: {
12: Q1 a = new Q1();
13: a.start();
14: }
15: }
21 years ago