Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!

Nisheeth Kaushal

Ranch Hand
+ Follow
since Jul 20, 2001
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 Nisheeth Kaushal

Thanx Jamal for discussion link.
Bye.
Hi all look at the code below
public class Question08 {
public static void main(String[] args) {
Question08 q08 = new Question08();
q08.doSomething();//line 1
Thread.sleep(20000);
}
public void doSomething(){
Object[] objArray = new Object[2];
for(int i=0;i<objArray.length;i++){
objArray[i] = new Object();
}
}
}

The answer is 3 can anzone pls explain me the reasons thanx in advance.
Nisheeth
Hi Corey,
Thanx.

Nisheeth.
Bye
Hi all,
Does Sun is going to refresh the exam course, if it does that, then what is the proposed date for that.
I am going to appear for the exam on 4th or 5th so, please help me urgently.
I am prepared with the old course of Mughal and RD.
Please help me urgently.
I am online for 1 hr.
Thanx in advance.
Bye.
Nisheeth
Someone written that this() and super() must be the first line of any constructor, so this means that if they both came in the same class, then who is going to get the first statement within the constructor, or this means that the java doesnot support the referring of both the superclass and object default construtor from a constructor.
Please Help
Nisheeth KAUSHAL
Hello friends,
I am using the rules round up game of this site and there i find a question that
"In a switch construct, the default value will execute if no values match the switch() construct.
I make it false b'coz i think that a default value may also execute if there is no break statement with the previous one."
But the forum says it true, "if there are no matching construct found the default will run."
please help,
Nisheeth
Hello friends,
Here i want to forward a point which is ambiguous who r the c++ programmers,
Well if u define the integer variable as
int x=y=z=0;
This will give an error, as variable y is not defined, so u must do it like this.
int x,y,z;
x=y=z=0;
Well i think most of u know this but i just want to put a point in ur knowledge.
bye,
Nisheeth KAUSHAL
Hi Friends,
I was reading the objectives of SCJP2 exam, and there i find that coding the inner classes in accordance with their precedence is an objective of the exam.
So, friends can anyone please explain this particular objective.
Thanx in advance,
Nisheeth
Oh Marcus,
Its great to see a mail from a person like u.
Well in this question i think that even there is no need to cast the object of ThisClass, b'coz every object is a blueprint of Object class bydefault.
And this can be more understandable if explain it by an example-
Suppose we have a vehicle class, which gives us a methodology that whenever we can implement, we get a new vehicle.
And suppose we have a car class, which extends the vehicle class, and provide another object or methodology or formula or blueprint that on implementing gives us a car.
but this does not mean that methodology of implementing the vehicle is also the method for implementing a car.
HTH
-Nisheeth
Hi all,
Thanx to all,
I wud like to ask one more question to Mark that as he said that Default constructor is not invoked even once.
But if u use something like this.
public Vehicle() {
System.out.println("Default Constructor");
}
This will print the above statement, so i think that the instantiation of default constructor is based on the object that u create in the subclass.
So, as we are not creating any vehicle no arg object, a super will be embed and call the default constructor of the superclass.
Tx
Nisheeth
hi Anukampa,
For how much money, u can sell it in India.
And also ur expiry date is too close.
Nisheeth
Hi Friends
I have a difficulty here in this particular quesiton
class Vehicle {
String str ;
public Vehicle() {
}

public Vehicle ( String s ) {
str = s;
}
}
public class Car extends Vehicle {
public static void main (String args[] ) {
final Vehicle v = new Vehicle ( " Hello" );
v = new Vehicle ( " How are you");
v.str = "How is going";
System.out.println( "Greeting is : " + v.str );
}
}
A) Compiler error while subclassing the Vehicle
B) Compiler error , you cannot assign a value to final variable
B) Prints Hello
C) Prints How is going
This class is executing easily, but i think that the subclass will see for a default constructor, and if it does not find it, it will throw an error.
This particular program is producing error, but b'coz of fina variable not for the reason which i want.
Please help me,
Thanx in advance.
Nisheeth
Please check the other mail with the same topic and the same name.
Sorry for inconveyance.
Thanx.
Nisheeth
[ January 22, 2002: Message edited by: Nisheeth Kaushal ]
Hi Sonir,
The value of i will not go upto 9,
Case 1 : When value of i is 0 then the sum of i+j will not increase 10 as the max value of j is 9.
o/p - a hello will be printed
Case 2 : In this case also when the value is 1
o/p - a hello will be printed
Case 3 : In this iteration the value of i is 2
so the sum of i+j is more than 11, and that is the terminating condition.
HTH
Nisheeth