me marca Error!!!!!!!!!
Hola este programa me marca error en el public static void main(String args[]) {, alguien podria ayudarme
/*
* Determinar el tipo de formato que se desea en la fecha*/
import java.text.DateFormat;
import java.util.Date;
import javax.swing.JOptionPane;
public class Fechas {
// test constructors of class Time2
Time2 t1, t2, t3, t4, t5, t6;
Date today;
String dateOut;
DateFormat dateFormatter;
public static void main(String args[]) {
int choice; // user's choice of which shape to draw
// initialize applet by obtaining user's choice
public void init() {
String input; // user's input
// obtain user's choice
displayField.setText("¿Qué formato de fecha desea?: ");
//String output = "¿Qué formato de fecha desea?: ";
input =JOptionPane.showInputDialog(
"1> Formato dd/mm/aaaa"
+ "2> Formato mm/dd/aaaa"
+ "3> Formato aaaa/mm/dd"
+ "4> Formato dd/mm/aaaa hh:mm:ss"
+ "5> hh:mm:ssn");
// convert user's input to an int
choice = Integer.parseInt(input);
}//fin init
// draw shapes on applet's background
public void paint(Graphics g) {
// call inherited version of method paint
super.paint(g);
// loop 10 times, counting from 0 through 9
for (int i = 0; i < 10; i++) {
// determine shape to draw based on user's choice
switch (choice) {
case 1 :
String output =
"Formato dd/mm/aaaa: " + SimpleDateFormat formatter =
new SimpleDateFormat("dd.MM.yyyy:");
Date currentTime_1 = new Date();
String dateString = formatter.format(currentTime_1);
// Parse the previous string back into a Date.
ParsePosition pos = new ParsePosition(0);
Date currentTime_2 = formatter.parse(dateString, pos);
break; // done processing case
case 2 :
String output =
"Formato mm/dd/aaaa: " + SimpleDateFormat formatter =
new SimpleDateFormat("MM.dd.yyyy:");
Date currentTime_1 = new Date();
String dateString = formatter.format(currentTime_1);
// Parse the previous string back into a Date.
ParsePosition pos = new ParsePosition(0);
Date currentTime_2 = formatter.parse(dateString, pos);
break; // done processing case
case 3 :
String output =
"Formato aaaa/mm/dd: " + SimpleDateFormat formatter =
new SimpleDateFormat("yyyy.MM.dd:");
Date currentTime_1 = new Date();
String dateString = formatter.format(currentTime_1);
// Parse the previous string back into a Date.
ParsePosition pos = new ParsePosition(0);
Date currentTime_2 = formatter.parse(dateString, pos);
break; // done processing case
case 4 : //Asigna el valor de la fecha de autorización del código.
String output =
"Formato dd/mm/aaaa hh:mm:ss: "+ SimpleDateFormat formatter =
new SimpleDateFormat("dd.MM.yyy 'at' hh:mm:ss a zzz:");
Date currentTime_1 = new Date();
String dateString = formatter.format(currentTime_1);
// Parse the previous string back into a Date.
ParsePosition pos = new ParsePosition(0);
Date currentTime_2 = formatter.parse(dateString, pos);
break; // done processing case
case 5 :
String output =
"Formato hh:mm:ss: "+SimpleDateFormat formatter =
new SimpleDateFormat("hh:mm:ss a zzz:");
Date currentTime_1 = new Date();
String dateString = formatter.format(currentTime_1);
// Parse the previous string back into a Date.
ParsePosition pos = new ParsePosition(0);
Date currentTime_2 = formatter.parse(dateString, pos);
break; // done processing case
default :
g.drawString("Opcion Inválida", 10, 20 + i * 15);
} // end switch structure
} // end for structure
} // end paint method
} // end class SwitchTest
} // end class Fechas
/*
* Determinar el tipo de formato que se desea en la fecha*/
import java.text.DateFormat;
import java.util.Date;
import javax.swing.JOptionPane;
public class Fechas {
// test constructors of class Time2
Time2 t1, t2, t3, t4, t5, t6;
Date today;
String dateOut;
DateFormat dateFormatter;
public static void main(String args[]) {
int choice; // user's choice of which shape to draw
// initialize applet by obtaining user's choice
public void init() {
String input; // user's input
// obtain user's choice
displayField.setText("¿Qué formato de fecha desea?: ");
//String output = "¿Qué formato de fecha desea?: ";
input =JOptionPane.showInputDialog(
"1> Formato dd/mm/aaaa"
+ "2> Formato mm/dd/aaaa"
+ "3> Formato aaaa/mm/dd"
+ "4> Formato dd/mm/aaaa hh:mm:ss"
+ "5> hh:mm:ssn");
// convert user's input to an int
choice = Integer.parseInt(input);
}//fin init
// draw shapes on applet's background
public void paint(Graphics g) {
// call inherited version of method paint
super.paint(g);
// loop 10 times, counting from 0 through 9
for (int i = 0; i < 10; i++) {
// determine shape to draw based on user's choice
switch (choice) {
case 1 :
String output =
"Formato dd/mm/aaaa: " + SimpleDateFormat formatter =
new SimpleDateFormat("dd.MM.yyyy:");
Date currentTime_1 = new Date();
String dateString = formatter.format(currentTime_1);
// Parse the previous string back into a Date.
ParsePosition pos = new ParsePosition(0);
Date currentTime_2 = formatter.parse(dateString, pos);
break; // done processing case
case 2 :
String output =
"Formato mm/dd/aaaa: " + SimpleDateFormat formatter =
new SimpleDateFormat("MM.dd.yyyy:");
Date currentTime_1 = new Date();
String dateString = formatter.format(currentTime_1);
// Parse the previous string back into a Date.
ParsePosition pos = new ParsePosition(0);
Date currentTime_2 = formatter.parse(dateString, pos);
break; // done processing case
case 3 :
String output =
"Formato aaaa/mm/dd: " + SimpleDateFormat formatter =
new SimpleDateFormat("yyyy.MM.dd:");
Date currentTime_1 = new Date();
String dateString = formatter.format(currentTime_1);
// Parse the previous string back into a Date.
ParsePosition pos = new ParsePosition(0);
Date currentTime_2 = formatter.parse(dateString, pos);
break; // done processing case
case 4 : //Asigna el valor de la fecha de autorización del código.
String output =
"Formato dd/mm/aaaa hh:mm:ss: "+ SimpleDateFormat formatter =
new SimpleDateFormat("dd.MM.yyy 'at' hh:mm:ss a zzz:");
Date currentTime_1 = new Date();
String dateString = formatter.format(currentTime_1);
// Parse the previous string back into a Date.
ParsePosition pos = new ParsePosition(0);
Date currentTime_2 = formatter.parse(dateString, pos);
break; // done processing case
case 5 :
String output =
"Formato hh:mm:ss: "+SimpleDateFormat formatter =
new SimpleDateFormat("hh:mm:ss a zzz:");
Date currentTime_1 = new Date();
String dateString = formatter.format(currentTime_1);
// Parse the previous string back into a Date.
ParsePosition pos = new ParsePosition(0);
Date currentTime_2 = formatter.parse(dateString, pos);
break; // done processing case
default :
g.drawString("Opcion Inválida", 10, 20 + i * 15);
} // end switch structure
} // end for structure
} // end paint method
} // end class SwitchTest
} // end class Fechas