Compilation error please help me ...

class CertKiller {

Boochy booch;

public Certkiller() { booch = new Boochy(this); }

}

class Boochy {

Certkiller smooch;

public Boochy(Certkiller s) { smooch = s; }

}

public class CertkillerTest {

public static void main(String[] args) {

Certkiller snoog = new Certkiller();

snoog = null;

}

}

output :

D:\>javac CertkillerTest.java

CertkillerTest.java:3: invalid method declaration; return type required

public Certkiller() { booch = new Boochy(this); }

^

1 error

[585 byte] By [Tatona] at [2007-10-3 2:50:24]
# 1
You class name is CertKiller "K' is uppercasebut constructor you declare public Certkiller()'k' is lowercase you constructor should be public CertKiller()'K' should be uppercaseJinath
JBNa at 2007-7-14 20:39:14 > top of Java-index,Java Essentials,New To Java...
# 2

Here is a puzzle for you:

Find a typo in the code below

> class CertKiller {

> Boochy booch;

> public Certkiller() { booch = new Boochy(this); }

> }

> class Boochy {

> Certkiller smooch;

> public Boochy(Certkiller s) { smooch = s; }

> }

> public class CertkillerTest {

> public static void main(String[] args) {

> Certkiller snoog = new Certkiller();

> snoog = null;

> }

> }

>

r035198xa at 2007-7-14 20:39:14 > top of Java-index,Java Essentials,New To Java...
# 3
Thanks i got it.
Tatona at 2007-7-14 20:39:14 > top of Java-index,Java Essentials,New To Java...
# 4

> D:\>javac CertkillerTest.java

> CertkillerTest.java:3: invalid method declaration;

> return type required

> public Certkiller() { booch = new Boochy(this); }

>^

Looking at your last couple of posts, you need to learn how to read compiler errors.

CertkillerTest.java:3

In the file CertkillerTest.java, on line 3 we have found an error.

invalid method declaration

A methdod declaration is incorrect

return type required

All methods should have a return type. But hold on, what about ctors. Well, they are ctors, not methods (a small difference, but a difference). So why is the compiler complaining. Well as we all know the ctor has to have the same name as the class. The class is CertKiller, and the ctor is Certkiller. And as we should know, Java is case sensitive. So they are not the same name. As such, it is not a ctor, but a method, and should have a return type

mlka at 2007-7-14 20:39:14 > top of Java-index,Java Essentials,New To Java...
# 5

> Thanks i got it.

As has been advised in [url=http://forum.java.sun.com/thread.jspa?threadID=760562]this thread[/url] you need to change your font; possibly

to a larger point-size. If you can't distinguish a lower case 'k' from an

upper case 'K', your current font most likely is too small or an unreadable

font. No insult intended, please consider the option.

kind regards,

Jos

JosAHa at 2007-7-14 20:39:14 > top of Java-index,Java Essentials,New To Java...