I wrote a program, and I need to know what to do to make it run - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

I wrote a program, and I need to know what to do to make it run

BrianJasperBrianJasper Posts: 2Member
So, I am trying to get this program to work, and I need some help. Here is my method in a "main" method, inside the "class" song. I am getting a few syntax errors, and I don't know what to do? Please help. Here is my code, and the listed errors after.


public class song
{
public static void main(String args[])
{
public void printSong()
{
String day="";
for(int i=1;i<=12;i++)
{
switch(i)
{
case 1:
day="first";
break;
case 2:
day="second";
break;
case 3:
day="third";
break;
case 4:
day="fourth";
break;
case 5:
day="fifth";
break;
case 6:
day="sixth";
break;
case 7:
day="seventh";
break;
case 8:
day="eighth";
break;
case 9:
day="ninth";
break;
case 10:
day="tenth";
break;
case 11:
day="eleventh";
break;
case 12:
day="twelveth";
break;
}
System.out.printf( "On the %s day of Christmas
my true love sent to me:
",day);
}
}
}
}


Syntax error on token "void", @ expected
printSong cannot be resolved to a type
Syntax error on token "{", delete this token
Illegal modifier for parameter day; only final is permitted
Syntax error on token "}", delete this token
Sign In or Register to comment.