View Full Version : Is this a freakin joke?!

05-02-2005, 03:33 AM
I decided to try my hand at java.....so far i'm not impressed....i just spent the last hour trying to figure out why my button wasn't showing up in the window.. everything compiled fine, without any warning....still, no button.........

i fixed it, but appearantly, the (sole) constructor which created the button, wasn't getting called.....

i had...

public class MyClass{
public void MyClass(){...}

what's wrong with this picture?

should i expect a lot more of this out of java?

05-02-2005, 04:33 AM
You sure you created an instance of the class somewhere? Note that everything (most) is pointers in java so you have to use the new operator, not just this: MyClass c;

05-02-2005, 05:08 AM
no no...i figured out the problem before i posted here...

i posted because i was a bit disgusted that the java compiler let me compile a constructor with a return type and didn't say a word. because it had a return type, the overload didn't get resolved "properly"

05-02-2005, 05:46 AM
from your post it is really not clear what is wrong, and how java is at fault here. Most likely it is your inexperiance with the language that caused the problem and not the language it self.

What IDE are you using? and then, are you using awt or swing libraries?

05-02-2005, 06:10 AM
ide = commando
i'm using swing, which means i'm also using awt.

can a constructor return a value in java? if so, why does Learning Java by O'Reilly say otherwise?

05-02-2005, 06:32 AM
>> a constructor with a return type

I noticed this as soon as I saw it but I have never tried to compile it like that and I don't know if it is technically legal Java code or not. Obviously it is but I'm sure there is a reason for it. Something like that wouldn't go unnoticed easily. Maybe check to see if compiler warnings are turned on?

05-02-2005, 06:56 AM
i've never even heard of that ide dude; I suggest one of these three: Eclipse, NetBeans, JbuilderX

NetBeans has a great GUI builder feature.

05-02-2005, 07:04 AM
commando -> command line

05-02-2005, 07:07 AM
oh, woops :o in that case, make sure you are using the newest version of java.