Home arrow static arrow Java Programming [Archive] - java constructors drive me mad
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - java constructors drive me mad
This topic has 219 replies on 15 pages.    « Previous | 1 | ... 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | Next »

Posts:835
Registered: 2/12/01
Re: java constructors drive me mad  
Jun 20, 2004 9:27 AM (reply 90 of 219)



 
Not so wise when put in the context of language, for
which Java is...
The prowerb is about the SUM. Sum has commutativity property. If we have V A L derived and extending it with J O K, we can start putting "K" in the last position, then "V" in the first, etc. The order does not matter. You can even fill all the fields simultaneously, OK?

Each word being an item, I can slightly re-position
I don't now what are you doing there.
root1 = new Root("root1");root2 = new Root("root2");

Try to reposition these statements.

So, you examples are off-topic. Try to bring something more appropriate.

 

Posts:205
Registered: 6/15/04
Re: java constructors drive me mad  
Jun 20, 2004 9:34 AM (reply 91 of 219)



 
Just a quick one, while I wait for my coffee to brew :o)

root1 = new Root("root1");root2 = new Root("root2");

Try to reposition these statements.

obj1 = new Object();obj2 = new Object(obj1);


Try to reposition these statements.
 

Posts:835
Registered: 2/12/01
Re: java constructors drive me mad  
Jun 20, 2004 9:48 AM (reply 92 of 219)



 
Have you read through the forum? Where did I gave a recommendation to use uninitialized variables?
 

Posts:205
Registered: 6/15/04
Re: java constructors drive me mad  
Jun 20, 2004 9:50 AM (reply 93 of 219)



 
Are you serious?

Have you read what you wrote above?
 

Posts:205
Registered: 6/15/04
Re: java constructors drive me mad  
Jun 20, 2004 9:54 AM (reply 94 of 219)



 
Have you read through the forum? Where did I gave a
recommendation to use uninitialized variables?

I seem to recall you writing this ....

class Tree extends JTree {private final DefaultMutableTreeNode root;Tree() {super(new DefaultTreeModel(root = newDefaultMutableTreeNode("Download Manager"))); }norclass Tree extends JTree {private final DefaultMutableTreeNode root =  newDefaultMutableTreeNode("Download Manager");Tree() {super(new DefaultTreeModel(root));}compiles

I don't use uninitialized constants anywhere. Seems
that compiler is wrong. What is the problem to
allocate memory for the new instance, initialize the
root variable and call superconstructor?

In which you clearly use uninitialized variables!
 

Posts:835
Registered: 2/12/01
Re: java constructors drive me mad  
Jun 20, 2004 10:22 AM (reply 95 of 219)



 
In the first example I pass an initialized ref to the super(). As about the second, the fields of that kind should be initialized before calling constructor. Where do I insist on using uninitialized variables?
 

Posts:205
Registered: 6/15/04
Re: java constructors drive me mad  
Jun 20, 2004 10:32 AM (reply 96 of 219)



 
In the first example I pass an initialized ref
to the super().

No, you do not. Why? Because local fields are not initialized before the call to super()

As about the second, the fields of
that kind should be initialized before calling
constructor.

No, they should not. Read JLS.

Where do I insist on using uninitialized
variables?

In the examples quoted.

 

Posts:835
Registered: 2/12/01
Re: java constructors drive me mad  
Jun 20, 2004 11:09 AM (reply 97 of 219)



 
So, you guys bring examples trying to show that my considerations are against rules of nature/logic. When I show that this is Java that has an artificial constratint not existing in the nature, you refer me to JLS. These are beleivers who tell that anything inconsistent with Bible is false, forbid observing outward things and thinking.
 

Posts:205
Registered: 6/15/04
Re: java constructors drive me mad  
Jun 20, 2004 11:14 AM (reply 98 of 219)



 
Can you even read?
 

Posts:835
Registered: 2/12/01
Re: java constructors drive me mad  
Jun 20, 2004 11:29 AM (reply 99 of 219)



 
In the first example I pass an initialized
ref to the super().

No, you do not. Why? Because local fields are not
initialized before the call to super()

Can you even read?

You tell that that java does not allow anything until super is called(). You're thinking in java. I'm not constraind by this limitation.
 

Posts:835
Registered: 2/12/01
Re: java constructors drive me mad  
Jun 20, 2004 11:42 AM (reply 100 of 219)



 
In the first example I pass an initialized
ref
to the super().

No, you do not. Why? Because local fields are not
initialized before the call to super()

If you don't beleive me (I insult java-minded programmers by not thinking in java), consider post 60 by jverd.
 

Posts:11,186
Registered: 06.04.04
Re: java constructors drive me mad  
Jun 20, 2004 1:50 PM (reply 101 of 219)



 
IMHO this discussion should (and could) be carried further in a much more polite (and friendly?)
fashion. The core of the problem (challenge? ) is: why is it disallowed to set a member variable
without the super class being fully initialized? What are the constraints and can we come up with
a killer counter example? (no matter how 'sick'). And if we can't, is the current 'rule' the least
restrictive rule?

kind regards,

Jos
 

Posts:205
Registered: 6/15/04
Re: java constructors drive me mad  
Jun 20, 2004 3:00 PM (reply 102 of 219)



 

If you don't beleive me (I insult java-minded
programmers by not thinking in java), consider post 60
by jverd.

I am sorry valjok, I do not mean to be rude, nor do I mean to insult you (or your intelligence)

I just keep getting confused by the fact that one minute we are talking Java specific and the next we are talking programming in general, and I can't seem to pick up on the cues telling which line we are going down.

Further, it does not help when you use such phrases as "Please, anybody, give a URL link to this poor lost boy", "I understand you is a touchy boy who does not like truth. I've told you if you think it is a nonsense do not dumb the board.", and "I insult java-minded programmers by not thinking in java"; whilst offering no apology when you agree with another post saying what I am saying.

I find that difficult, and rude.

 

Posts:2,830
Registered: 9/1/03
Re: java constructors drive me mad  
Jun 20, 2004 3:13 PM (reply 103 of 219)



 
IMHO this discussion should (and could) be carried
further in a much more polite (and friendly?)
fashion. The core of the problem (challenge? ) is: why
is it disallowed to set a member variable
without the super class being fully initialized?

it was already explained ... i can't see how this argument is still continuing ?

you can't set the fields of some uninitialised class because it doesn't exist
at all ! i.e. take a man who has no hands, and ask him to catch a ball, obviously
he cannot.

its the same effect, where can the variable go ? nowhere. the jvm has nowhere
to put it yet, so it tells you so.

assign the variable to the class once it exists, not before hand ...
 

Posts:835
Registered: 2/12/01
Re: java constructors drive me mad  
Jun 20, 2004 11:19 PM (reply 104 of 219)



 

it was already explained ... i can't see how this
argument is still continuing ?
I was already explained that most of the posters are thinking in java. Particularly, thay cannot imagine that memory is allocated for the whole object at once (objects are localized in time and space). Any object is not valid until all fields are initialized. It does not matter in which order you do it.

you can't set the fields of some uninitialised class
because it doesn't exist
What does not exist?

its the same effect, where can the variable go ?
nowhere. the jvm has nowhere
to put it yet, so it tells you so.

JLS == absolute thruth?

at all ! i.e. take a man who has no hands, and ask him
to catch a ball,
You've forgot to initialize hand fields.

assign the variable to the class once it exists, not
before hand ...
Class c = new Variable()?
 
This topic has 219 replies on 15 pages.    « Previous | 1 | ... 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | Next »