Deepak Chopra

Ranch Hand
+ Follow
since Jul 23, 2007
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Deepak Chopra

I would recommend you to use "wait" and "notify" instead of going in an infinite loop.

Lets the parent thread wait on an object and let the child thread notify parent thread once it finish the processing. This would give very good performance CPU wise and will reduce your execution time as well.
A simple way to test it would be - telnet localhost 8888

Nitin Fresher wrote:class Pets{


Why couldn't it not make an array of Pets
C:\>javac Pets.java
Pets.java:14: incompatible types
found : Pets[]
required: Pets
Pets petArray = new Pets[3];
^
1 error




As you see compiler is complaining "incompatible type", means LHS and RHS are incompatible.
What is LHS ? ==> Pets { an Object }
What is RHS> ==> Pets[] {an Array of Pets}

13 years ago
What kind of Idea you are looking for?
How are you planning to have a static lock, I mean lock over a class?

I believe you can always have a lock over class instance or Do you mean to say - lock over static properties of a class?

Beside you code doesn't have run method, so Its difficult to know what are you trying to do ?
try apache velocity...Txt base template engine...
13 years ago
Hope this might be of some help...
Serialization
13 years ago
Hi Ram,

I have also went through same phase as yours. I passed out in 2006 with B.Tech in Telecommunication. I was hired by a small company as Java developer.
I was also assigned as a production support for a product for a bank. Making it worse it was a big project and my company was small, company was billing for 3 person but i was handling it alone. I still can not imagine my 2 years there, but I kept positive attitude. I keep learning and my effort was also rewarding by company. I won "young achiever" award. Believe me on my first day - I did not even know how to write "Hello World" program.

I gave 8 months, I studied everyday from 10 PM to 12:00 midnight and finished SCJP and SCWCD in a row. I am so much comfortable with JAVA after that. Currently I am a team leader and solution architect. I have also finished 2 open source project.

My suggestion to you will be - Keep the positive attitude and start learning. Follow this forum and read how to approach solution.Java not a rocket science. You may also start some small project by your self and start coding. It such a nice feeling when you start a project and when you finish it.

I wish you BEST OF LUCK.
13 years ago

Johnny Fawkes wrote:This is little offtopic, but I wanted to say that shrine in your website, looks magnificent:
http://ougaming.deviantart.com/gallery/#/d2x3utv



I agree with you...Its awesome..!
13 years ago
A quick way to check if your classpath has been set properly - type javac and press enter on comman prompt in your source directory.
If it shows you - command not found, you may want to check your classpath otherwise as Mohamed said " type dir and check the class file".
13 years ago
hi Hareendra ,

Yes If you write following piece of code, you will not get any error-


You can also consider the way an object is initialized in java -

1) Static block of super class executes

2) Static block of Subclass executes

3) Inside constructor of subclass

4) call to super constructor

5) call of Object Class constructor

6) Instance Variable of super class executes

7) init blocks of super class executes,in the order in which they appear

8) Super class constructor executes

9) Instance Variable of Subclass are initialized

10) Init blocks of subclass executes, in the order in which they appear

11) Subclass constructor executes

Source - Object Initialization in JAVA
Hi Anjali,

As the word itself says - "Final" means the reference is final. for example -

Lets say we have a class Bus


For Serialization, you may refer to this article -
Basics of Serialization



Objects are created on run time so compiler can not determine about locking and ownership at compile time .This is decided at run time and thats why you get RunTimeException..