Authentication Constructor Smack API Problem

Hi Everyone

I am hoping that someone would be able to help me, My question is this, i am learning Java and I am intrested In building a chat client using the smack API.

I have built a login form using netbeans no code as yet just the layout and I read on the smack API javadocs page about a constructor called Authentication this is my code as a test show below

import org.jivesoftware.smack.packet.*;

public class Authentication extends IQ {

public Authentication() {

}

}

import org.jivesoftware.smack.packet.*;

public class Authentication extends IQ {

public Authentication() {

}

}

however the text that I have changed colour shown above produces an error saying this

“Authentication is not abstract and does not override abstract method getChildElementXML() in org.jivesoftware.smack.packet.IQ

I am not sure what I am doing wrong as any help would be appriciated

Joe

Before giving a quick answer, I will say that you should be asking these types of basic Java questions in a different forum. I realize that you are trying to use Smack, but your questions have nothing to do with Smack but are simply basic Java questions. Try asking such questions on somewhere like stackoverflow.com in the future.

Now the answer. You are attempting to extend the class IQ, which is an abstract class with one abstract method getChildElementXML(). As the error is reporting, you must implement this method.

Of course, from your posting, I don’t think this is what you are intending to do, at least I hope not as a learning to use Java exercise. I would imagine that you are attempting to use the Authentication class, which does not require you to create your own class, which is what you are doing.

I suggest that if you want to continue with your project, you should start with the developer documentation.

@rcollier

Thanks for your post you have helped me out the reasson why i thought it was a class was becuase when I was reading over the Javadocs section of smack that is where i got confused

Joe