Navin Narayan

Greenhorn
+ Follow
since Jan 25, 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 Navin Narayan

Hi all,
I am trying to access BETRIEVE database thru java. I Have downloaded the JDBC drivers for Btreive but i don't know the port no for btreive.
If anyone ahs any clue about it, pls pass it on.
Navin.
Hi Sajida,
Let me answer it this way,
Your question "Why are the methods static"
Let us assume that JavaSoft guys didn't make the method static.
And that you are writing a program. Your program tells the user every one min what the time is.
So, your program will have to sleep for atleast 1 min.
If sleep was not static, your program would have to unnessarily extend Thread just to have that one functionality.
Also, in programs which are CPU intensive, it is a good idea to call yield. But does that mean that all CPU intensive programs have to extend Thread just because of that one fuctionality "Thread.yield()".
Luckily for us, JavaSoft people understood this and made those two methods static. Now whenever, any method calls "Thread.sleep()" or "Thread.yield()", that method rsply goes to sleep or yields.
Hi Sajida,
Your are right, that they are static methods and are basically useful for threads only. But maybe you overlook that in Java, multithreading is built in at the basic level. So even your "main" method runs as a (user) thread.
So, it is useful for these threads (which do not extend Thread and implement Runnable) to go to sleep if they have nothing to do or temporarily stop running for some other higher priority thread.
Hope that answers your question
Navin.
Hi Shabbir,
Most often, it can be assumed that hashcode() gives an int which is related to the memory address. (Even though it is not necessary for every java machine implementation)
So in this case two objects have been created. Both have unique memory addresses. So their hashcode is different.
Hope that answers your question
Navin.
Hi All,
The problem has been well explained by Jane Griscti. You can find it at the following link
http://www.javaranch.com/ubb/Forum24/HTML/006887.html
Navin
Hi hui,

Originally posted by a hui:
I guess I'd like to know why these numbers are octal and not binary, and also how can a number be represented in binary in a program?

Thanks
AH



The numbers are in Octal since they start with 0 .
If they started with 0x , they would be in hex.
Hi Hima,
As to your first doubt
int i = 10;
i = i++;
It is better if you assume it as
i++;
i=10;
What should happen is that i should return its value
and then increment it.
But what seems to happen always is that i value is incremented
in the first cycle and then in the second cycle, i is given the value it had before it incremented thus wasting the increment.
As for your second doubt,
I think you are assuming the
"System.out.println(00001010^00001000);" to be
binary numbers where in fact they are octal.
Hope that answers your question
Navin
Hi Chris,
Just change the name of your program to "MenuTest" or something other than Menu. That should do it
Navin
Hi Swati,
I am a SCJP and cleared the exam on Feb 14, 2001. You can be assured that the exam are mostly objective. The subjective questions do not go beyond one line i.e. they all have to be answered in a textfield. I received 56 objective and 3 one line answers.
All the best for your exams.
Navin.
Great Score Pravin. All the best for your future.
23 years ago
Good score buddy. Here is wishing you a bright future ahead of you.
23 years ago
Hi Folks,
Passed SCJP today with 93%. The exam was considerably easy after giving all the mock exams. I had referred RHE, Jamie Jaworski and some notes on the net. Among them, Velmurugan's notes were very good. Thanks Velu, you have done a great job. I would also like to thank the people at JavaRanch for this fabulous site.
Advice for would-be-SCJP's
-practise a lot of code
-give a lot of mock exams
-Read the exam questions carefully
23 years ago
Hi nan,
You are right except for this we are
"To use enableEvents(AWTEvent.WINDOW_EVENT_MASK),
you must call super.precessWindowEvent(e),
otherwise actinPerformed() never will be called"
It is not to use enableEvents(AWTEvent.WINDOW_EVENT_MASK)
that we call super.precessWindowEvent(e), but only to invoke the super class's method which informs all the registered listeners about the event and calls their actionPerformed(e).
Regards,
Navin
Hi Taulha,
The reply is a little late but still. One can extend non-static inner classes. But still the inner class will depend on an instance of the outer class. Hope the following code helps.
class Outer {
class Inner{
public void display(){
System.out.println("Inner class display method");
}
}
}
class Test extends Outer.Inner {
Test(){
new Outer().super();
}
public static void main(String args[]){
new Test().display();
}
}