Si votre email correspond à un compte, vous recevrez un lien de réinitialisation.
Bonjour tous,En cherchant à compiler un exemple d'utilisation du pattern Factory,j'obtiens une erreur de typage...Je compile en Java 1.5public class TestExemples{public void utilisation( Factory fabrique ){TextComponent tc = fabrique.create();tc.setText( "essai" );}public TestExemples(){utilisation( new TextFactory1());utilisation( new TextFactory2());}}==>> incompatible typesz - found java.lang.Object but expectedjava.awt..TextComponentor mes factories sont :public class TextFactory1 implements Factory<TextComponent>{public TextComponent create(){return new TextArea(100,50);}}etpublic class TextFactory2 implements Factory<TextComponent>{public TextComponent create(){return new TextField(40);}}avec l'interfacepublic interface Factory<T>{public T create();}Quelqu'un a-t-il une idée?
Bonjour tous, En cherchant à compiler un exemple d'utilisation du pattern Factory, j'obtiens une erreur de typage... Je compile en Java 1.5 public class TestExemples { public void utilisation( Factory fabrique ){ TextComponent tc = fabrique.create(); tc.setText( "essai" ); } public TestExemples() { utilisation( new TextFactory1()); utilisation( new TextFactory2()); } } ==>> incompatible typesz - found java.lang.Object but expected java.awt..TextComponent or mes factories sont : public class TextFactory1 implements Factory<TextComponent> { public TextComponent create() { return new TextArea(100,50); } } et public class TextFactory2 implements Factory<TextComponent> { public TextComponent create() { return new TextField(40); } } avec l'interface public interface Factory<T>{ public T create(); } Quelqu'un a-t-il une idée?
essayes avec ce bout de code:public void utilisation( Factory<TextComponent> fabrique ){TextComponent tc = fabrique.create();tc.setText( "essai" );}
essayes avec ce bout de code: public void utilisation( Factory<TextComponent> fabrique ){ TextComponent tc = fabrique.create(); tc.setText( "essai" ); }