Keresés

Új hozzászólás Aktív témák

  • Jhonny06

    veterán

    válasz Philips103 #9802 üzenetére

    Első körben:

    C:\Program Files\NetBeans 7.x\etc\netbeans.conf

    Change the following line to point it where your java installation is :

    netbeans_jdkhome="C:\Program Files\Java\jdk1.7xxxxx"

    You may need Administrator privileges to edit netbeans.conf

  • Jhonny06

    veterán

    Sziasztok!

    Van egy generikus osztályom és szeretnék egy függvényt, ami tömbbé alakít mondjuk egy listát, amit ezzel az osztállyal példányosítok, de sehogy nem akar működni. A sima list.toArray() ugye Object tömböt ad vissza, hiába castolom T[]-re.

    public class CircularBuffer<T> {
    T[] a;

    T[] toArray() {
    //???
    }
    }

    Main:

    CircularBuffer<Integer> cb = new CircularBuffer<>(2);
    cb.put(2);
    cb.put(3);
    Integer[] array = cb.toArray(); // itt lenne a lényeg

  • Jhonny06

    veterán

    Sziasztok!

    Azt meg lehet valahogy oldani Eclipse-ben, hogy ha bezárom az alkalmazást és újra elindítom, akkor Package Explorer-ben az adott projekt alatt lévő package-ek ne csukódjanak be, hanem mindegyik ugyanúgy "nyitva" legyen (tehát látszódjanak a class file-ok), mint amikor dolgoztam vele? Köszi!

  • Jhonny06

    veterán

    Sziasztok!

    Kaptam egy teszt feladatot, TicTacToe. A Consultant interface-t kell implementálni, igazából 1 függvény van benne összesen, ami egy adott állás alapján javasol egy lépést, majd azt az értéket visszaadja. Azon gondolkodtam, hogy itt érdemes még létrehozni külön függvényeket (pl. checkForWin, checkForDraw, stb.), vagy elég a suggest függvényen belül implementálni az egész logikát? Ti mit várnátok el, hogy elegáns? Gáz, ha minden azon az egy függvényen belül van, jobban "OO-sítani" kéne?

    Az van a leírásban, hogy a meglévő kódon már ne változtassak, de ha a YourConsultant osztályon belül még létre akarnék hozni plusz függvényeket, akkor elegáns lenne először az interface-t módosítani, de ezt elvileg nem akarják. Ezért is gondolom, hogy a suggest függvényben elég lenne megoldani az egészet.

    Please advise :R

    public class YourConsultant implements Consultant {

    @Override
    public CellLocation suggest(GameBoard gameBoard) {
    // TODO Auto-generated method stub
    return null;
    }

    Leírás:

    The goal of this exercise is for you to create an implementation of the
    Consultant interface. You can use the provided class YourConsultant that needs
    to be finished. We will run your solution against our unit tests. The source
    and unit tests for this project may be found in the zip file associated with
    this file.

    Please read the JavaDoc carefully.

    Keep in mind that:

    * We are only interested in an implementation for the Consultant interface. We
    do not, for instance, want an application that can interact with other
    (human) players. We do not expect any kind of GUI, nor do we expect a class
    with a main method.

    * We are not so much looking for a solution that performs very fast. If your
    implementation finds the best solution within a second, that is good enough.

    * We are interested in the readability of your code.

    * Follow the instructions carefully, but keep it simple! Your solution might of
    course require more files (Java types), be careful however not to
    over-engineer your solution.

    * You are not allowed to change existing code, i.e. do not change existing
    files.

Új hozzászólás Aktív témák

Hirdetés