teja dharma

Ranch Hand
+ Follow
since Feb 07, 2009
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 teja dharma

Bear Bibeault ,I don't know.What is the best answer if they ask these questions.What would you say if they ask the same questions to you?
13 years ago
what is the best answer in interview if they ask what is polymorphism? what is inheritance?
13 years ago

Prithvi Sehgal wrote:Hello,

Please have a look at GenericsConfusion

I have tried to explain the concept, if still don't understand. Refer back.

Hope this helps,


Excellent work Prithvi you cleared my doubt with a detailed example. Keep going. .
for,for each,while are used for iterations.
for loop is used if you already know how many times the loop has to executed.
while is used when you do not know the number of times loop has to executed.
for each introduced in 1.5 version is used for iterating only the elements in arrays,collections.
ex:

13 years ago


Thank you prithvi i understood explanation. If you dont mind could you provide a detailed example for
List<? extends Dog> animalList i hope you will.

Prithvi Sehgal wrote:Hi,

I doubt that we can add anything to the list. The reference has to be used to call methods so that w can get
polymorphic behavior. If you want to add something to the list, you got to change it to somewhat

If we are mantaining Dog,Cat, Animal heirarchy


k fine List<? super Dog> animalList for adding Dog or sub-type of Dog .What about List<? extends Dog> animalList you mean its impossible to add objects for animallist .If so why?If not how?I hope this discussion will be closed with your coming reply.
Hope this helps

you are doing well we can not predict the scores cosidering your mock scores as you told that you scored 61% in kathy i personally hope you would get 85+ if you the show the same attitude in the real exam. I suggest you get prepared well and check once or thrice frequently asked questions which are being asked for years in real exam, you will sure get on the exam with a good score . All the best.
k ..what i exactly mean is this "ArrayList<? extends B> a1 " can hold only the objects of B and its subclasses am i right?
If not what sort of objects it can hold exactly?
Not satisfied with your answer better you explain with a clean example for extends in generic no urgent take your own time.
In the below code when i try to add a1.add(new A() /new B() /new C()) its not compiling the method(a1.add()) is taking only null.
why so? what actually this ArrayList<? extends B> a1=new ArrayList() for ? what objects can we add to a1?


when ever you are performing any arithmetic operation the compiler always treats expression as max(int ,exp1,exp2)
suppose 3.0*4 in this expression the compiler treats this as max(int,float,int) result will be float value sice float has the max size than int.
In your expression s1*s2 the compiler trets it as max(int,short,short) result is int since int is greater in size than short.
For all Arithmetic tha same principle follows max(int,exp1,exp2)

program is working fine with out any error.save and compile again .Your code is correct its working.
I think you might have compiled the program like this

dirmkdir() doesn't throws any exception and more over you can not use checked exception for try catch if not the corresponding code /doesn't throws checked exception.

[Devaka: Added code tags - Please UseCodeTags]
while creating datasource userdsn for oracle 10g i am getting error "The setup routines for the oracle in OraDb10g_home1 odbc driver could not be loaded due to system error code 998"
The given below are the system environmental variables with values i have added according to my system.

JAVA_HOME C:\Program Files\Java\j2sdk1.5.0

CLASSPATH C:\Program Files\Java\j2sdk1.5.0\bin

PATH C:\Program Files\Java\j2sdk1.5.0\bin

Is this correct ? if not what are the environmental variables with values? Do i have to add for system or user? As for now i added for both system and user do i have to restart my pc?