Hello! I'm very new to writing java. And I keep getting the "Illegal Start of Type" error. I've tried everything to fix it. can anyone help me?
[CODE=Java]import java.util.*;
class ClockTalk {
public static void main(String[] arguments) {
//get current time and date
Calenda now = Calendar.getIns tance();
int hour = now.get(Calendr .HOUR_OF_DAY);
int minute = now.get(Calenda r.MINUTE);
int month = now.get(Calenda r.MONTH) + 1;
int day = now.get(Calenda r.DAY_OF_MONTH) ;
int year = now.get(Calenda r.YEAR);
//display greeting
if (hour < 12) {
System.out.prin tln("Good morning.\n");
} else if (hour < 17) {
System.out.prin tln("Good afternoon.\n");
} else {
System.out.prin tln("Good evening.\n");
}
//begin time message by showing the minutes
System.our.prin t("It's ");
if (minute != 0)
System.out.prin t(" " + minute + " ");
System.out.prin t( (minute !=1) ? "minutes" :
"minute");
System.out.prin t(" past");
//Display the hour
System.out.prin t(" "); //illegal start of type
System.out.prin t( (hour > 12) ? (hour - 12) : hour);
System.out.prin t(" o'clock on ");
}
//display the name of the month
switch (month) {
case 1:
System.out.prin t("January");
break;
case 2:
System.out.prin t("Febuary");
break;
case 3:
System.out.prin t("March");
break;
case 4:
System.out.prin t("April");
break;
case 5:
System.out.prin t("May");
break;
case 6:
System.out.prin t("June");
break;
case 7:
System.out.prin t("July");
break;
case 8:
System.out.prin t("Augest");
break;
case 9:
System.out.prin t("September" );
break;
case 10:
System.out.prin t("October");
break;
case 11:
System.out.prin t("November") ;
break;
case 12:
System.out.prin t("December") ;
}
//Display the date and year
{
System.out.prin tln(" " + day ", " + year + ".");
}[/CODE]
[CODE=Java]import java.util.*;
class ClockTalk {
public static void main(String[] arguments) {
//get current time and date
Calenda now = Calendar.getIns tance();
int hour = now.get(Calendr .HOUR_OF_DAY);
int minute = now.get(Calenda r.MINUTE);
int month = now.get(Calenda r.MONTH) + 1;
int day = now.get(Calenda r.DAY_OF_MONTH) ;
int year = now.get(Calenda r.YEAR);
//display greeting
if (hour < 12) {
System.out.prin tln("Good morning.\n");
} else if (hour < 17) {
System.out.prin tln("Good afternoon.\n");
} else {
System.out.prin tln("Good evening.\n");
}
//begin time message by showing the minutes
System.our.prin t("It's ");
if (minute != 0)
System.out.prin t(" " + minute + " ");
System.out.prin t( (minute !=1) ? "minutes" :
"minute");
System.out.prin t(" past");
//Display the hour
System.out.prin t(" "); //illegal start of type
System.out.prin t( (hour > 12) ? (hour - 12) : hour);
System.out.prin t(" o'clock on ");
}
//display the name of the month
switch (month) {
case 1:
System.out.prin t("January");
break;
case 2:
System.out.prin t("Febuary");
break;
case 3:
System.out.prin t("March");
break;
case 4:
System.out.prin t("April");
break;
case 5:
System.out.prin t("May");
break;
case 6:
System.out.prin t("June");
break;
case 7:
System.out.prin t("July");
break;
case 8:
System.out.prin t("Augest");
break;
case 9:
System.out.prin t("September" );
break;
case 10:
System.out.prin t("October");
break;
case 11:
System.out.prin t("November") ;
break;
case 12:
System.out.prin t("December") ;
}
//Display the date and year
{
System.out.prin tln(" " + day ", " + year + ".");
}[/CODE]
Comment