mardi 9 juin 2015

Why I obtain this error message when from a class I try to create a new instance of another class calling its constructor?

I have this problem trying to create a new object in Java.

So I have a "test" class named TestLoadFatturePa, this one:

package it.sistinf.ediwea.fepa;

import java.util.Vector;

public class TestLoadFatturePa {

    /**
     * Avvia l'applicazione.
     * @param args un array di argomenti della riga comandi
     */
    public static void main(java.lang.String[] args) {

        //Massivo2DB db = new Massivo2DB();
        LoadFatturePa loadFatturePa = LoadFatturePa();
        String fileFatturePa = "C:\\Users\\Andrea\\Desktop\\D150316.T1642.zip";
        Vector parametri = new Vector();
        parametri.add(fileFatturePa);
        loadFatturePad.run(parametri);
    }

}

As you can see in this class I create a new object of type LoadFatturePa, by this line:

LoadFatturePa loadFatturePa = LoadFatturePa();

This is the code of **LoadFatturePa*:

package it.sistinf.ediwea.fepa;

import it.sistinf.ediweb.XMLConvert.Massivo2DB;
import it.sistinf.ediweb.tracelog.TraceLog;

import java.util.Vector;

public class LoadFatturePa extends Massivo2DB {

    public LoadFatturePa() {
        super();
    }

    // Metodo run() che non prende parametri di input: logga un errore
    public void run() {
        TraceLog.scrivi("Test Esistenza Parametri", "Parametri mancanti", false, TraceLog.lowConsole + TraceLog.highTrace + TraceLog.highLog);
        target.azione("Parametri mancanti !!");
        return;
    }

    /*
     *  @param Vector parametri: rappresenta l'array di parametri che in questo caso contiene solo un elemento String rappresentante il path del
     *                           file .zip da scompattare e al cui interno reperire il file testuale contenente l'XML di tutte le fatture
     */
    public void run(Vector parametri) {

    }

}

As you can see in this class I have defined the costructor that simply perform the super().

The problem is that into the TestLoadFatturePa class give me an error when I try to create the new LoadFatturePa object, infact in this line:

LoadFatturePa loadFatturePa = LoadFatturePa();

it give me this error message:

The method LoadFatturePa() is undefined for the type TestLoadFatturePa

Why? What am I missing?

Aucun commentaire:

Enregistrer un commentaire