" Illégal Argument Exception: cannot Format....Object as Date."
I don't understand what is wrong? Could you help me?
package fr.codegym.task.task09.task0922;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
/*
Quelle est la date d'aujourd'hui ?
*/
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader lecteur = new BufferedReader(new InputStreamReader(System.in));
//écris ton code ici
SimpleDateFormat oldformat = new SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH);
Date olddate = oldformat.parse(lecteur.readLine());
SimpleDateFormat newf = new SimpleDateFormat("MMM dd,yyyy", Locale.ENGLISH);
newf.format(oldformat);
System.out.println(newf.format(oldformat).toUpperCase());
}
}