adil zahir

Greenhorn
+ Follow
since May 09, 2013
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by adil zahir

sorry i found the solution :

the question why x must be final ?



as i think because x it local variable and local variable go out of memory when the cod of method finish , so for inner class can stil acesse to variable must be in the heap for that we need to make it final !!!


hey everybody

i m preparing for the certification OCPJP 7 and i fiend in the book " A local class can access all the variables available in the body of the code in which it is defined.You can pass only final variables to a local inner class. " ( book Oracle Certified Professional Java SE 7 Programmer Exams 1Z0-804 and 1Z0-805 )

but the cod test i make in eclips give me other things :

la valeur de x 3 la valeur de y 4 la valeur de z 5 la valeur de e 6


can some one tell me how he is right ?
first you need to understand what that mean


we can write that in this way

we create Object Zookeeper and we use p reference to point to the Object Zookeeper , now we will invoke the method go() .

yes we can't call no-static method directly from static method but we can use instance Object ( create Object the same way we did in the example "Zookeeper p = new Zookeeper(); " ) to call the no-static method " p.go() "

hey Ben ,
let analyse the method go

void go() {
this.MyInner in = this.new MyInner(); // that mean Toolbox.MyInner in = Toolbox.new MyInner();
Integer i3 = in.doInner();
Toolbox t = new Toolbox();
st = t;
System.out.println(i3);
14. }



so the Object

this. new MyInner()

still have reference that object so for that it cant be GC.
and only D, E, and F are correct.
you can see other examplejavaranch
hey Vivek Raj ,
i juste want tell you part in the book K&B page 563

When using HashSet or LinkedHashSet, the objects you add to them
must override hashCode(). If they don't override hashCode(), the default Object.
hashCode() method will allow multiple objects that you might consider "meaningfully
equal" to be added to your "no duplicates allowed" set.



so like anayonkar say

In your case, you have not overridden hashCode method. Thus, add method will call hashCode method of Object class. Now, if that method returns different hashCode (and mostly it does) for a1 and a2, then from add method's perspective, those objects belong to two different buckets, and hence cannot be equal.

thnaks Henry Wong , i understand what you mean .
Henry Wong,

what i understand we can't do

add.( new Animales() )


because the object " new Animales() " not satisfied " the 3 rules

x IS-A Dog, x IS-A Animales, and x IS-A Object

?

Can you explain to us why you think that a List<? super Dog> should be able to add Dog, Animales, and Object? ... because that is not true.

Henry



yes that is not true we can't add

Animales

and

Object

but we can add

Dog



so for that i want knew why ?!!! because we have

List<? super Dog>

that mean evrything super Dog


why i can't do this

list1.add( new Animales)

we have

List< ? super Dog>

that mean we can add

Dog


Animales

and

Object


can you explain me why i have this Error ?
thanks Henry Wong and Chan Ag i understand now

Look at your string, and find everywhere there is a "dot followed by one character", and it should be clear what is going on.




that mean

"4.x45.a.3"

i will have 4 and x45 and a . the out put will be : 4 x45 a

that what i understand ??!!!


i didnt understand why i have that out put : 4 45
can sommeone explen for me why

s.split("\\.." + "");

she didnt make the out put : 4 x45 a 3
Hi Friends ,
i find that video in youtube , help me to understand Heap/Stack , and i want to share with you.

http://www.youtube.com/watch?v=oki53ZFo7mE

Chan ,
for the question

- Do you know what is an anonymous class? Do you know what is an inner class?


yes i knew what is an inner class and thanks for the link you give me .

and for the part i didn't understand ,


i hop my analyse was correcte !