zmarak ahmad djan

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

Recent posts by zmarak ahmad djan

two different points here :
-why the class in the interface ?
- usage ?

point one : notice that the class and the interface definition
depend on each other. if you declare this as two different compilation units
it would be possible but would need to be compiled together
the fact that the class is IN the interface expresses the fact
that the definition of the interfaces need that class.

point two:
- A) write a base class named "NormalProduct" and tax it.
all derived class will derive from this class.

-B) now a 1.5 feature
write a derived Interface IsTaxableSpecial extends IsTaxable
where the method getTaxAgent returns a local subclass of TaxAgent
write a class that derives from "NormalProduct" but implements
IsTaxableSpecial.
you're in for a (happy) surprise (courtesy J2SE 5)
20 years ago


[QB]Encapsulation might mean that you cannot access another object's data at all.


you are right to use "might" :

this code works perfectly!
though it does not break encapsulation
because encapsulation is NOT dealing with "protecting objects data".

now another example :

so encapsulation is more subtle than the use of getters and setters
20 years ago


[QB]Encapsulation might mean that you cannot access another object's data at all.


imprecise assertion:
[code]
public class X {
private int secret ;


}
20 years ago

Originally posted by Tony Morris:
The class needn't be abstract for it to be a member of an interface.
.



absolutely right

the class in the example does not need to be abstract

but in this example there was a pedagogical intent in doing so
I was trying to give some hints on why the class is here
and why it should be here.
designing a class that implements the interface gives some clues
20 years ago

[ September 10, 2004: Message edited by: zmarak ahmad djan ]
20 years ago
getSource() considered harmful:
except in rare occasions if you want to use getSource() you have
an architectural problem ..

is this possible? :
MyTextField extends TextField implements ActionListener
20 years ago
therer are also schedulers in java.util.concurrent packages in J2SE5
but wait until next year
20 years ago
java.util.Timer is not costly
(but I have never used it with such a wide gap ... have a try)
20 years ago


have fun

zmarak

I've never been a private but I actually *am* a publican
20 years ago
a filed marked transient is not serialiazed by the serialisation mechanism
that serialize the enclosing Object.

in your example you serialize explicitly the field "a"
so it should work that way!
transient is not a sticky marker to object "a" it's something
that is operating when serializing the ENCLOSING object.
20 years ago
code number one will issue an error
Borderlayout is not a package
20 years ago

so it's syntactic sugar
my advice: don't overuse (specifically don't overuse with static methods)
20 years ago
I don't understand what you're after...
a very simple example could help
what tests do you want to generate automagically?
20 years ago
do you want to generate code and dynamically compile it
or use reflection and a program that calls method dynamically?

in the later case a dynamic proxy is for you
(but the generic test code has to be clever )
20 years ago