Ho risolto creando dei nuovi packages nella cartella del mio javaproject.
PErò ora ho un altro problema, il seguente, cioè il mio codice funziona e fa quello che deve fare però mi da un "warning" su una classe :
Adds a default serial version ID to the selected type.
Adds a default serial version ID to the selected type. Use this option to add a user-defined ID in combination with custom serialization code if the type did undergo structural changes since its first release.
Che cosa devo fare?
Nel caso servisse, sto studiando le eccezioni e le mie 2 classi in questione sono le seguenti:
(L'errore di cui sopra lo ho nella 2° classe!!!)
codice:
package esercizio2;
/* exceptions/Ex1.java
// TIJ4 Chapter Exceptions, Exercise 1, page 452
/* Create a class with a main() that throws an object of class Exception
* inside a try block. Give the constructor for Exception a String argument.
* Catch the exception inside a catch clause and print the String argument.
* Add a finally clause and print a message to prove you were there.
*/
public class Ex1 {
public static void f() throws Exception1 {
System.out.println("Throwing MyException from f()");
throw new Exception1("From f()");
}
public static void main(String[] args) {
try {
f();
} catch(Exception1 e) {
System.err.println("Caught Exception1");
e.printStackTrace();
} finally {
System.out.println("Made it to finally");
}
}
}
codice:
package esercizio2;
//Questa classe l'ho usata per svolgere l'esercizio 1 (Ex1)
public class Exception1 extends Exception {
public Exception1(final String msg) {
super(msg);
System.out.println("Exception1(String msg)");
}
}