error: '.class' expected
I'm not able to find what is the error. I checked in many websites but not able to find why this error is coming
class Print { public static void printLine(char ch) { for(int i=1;i<=40;i++) { System.out.print(ch); } System.out.println(); } public static void main(String args[]) { char c='*'; printLine(char c); } }
To be a bit more clear about Johnny's correct assessment in the comments, don't specify a type for a parameter in a method call, just in definitions.
So in main, printLine(char c); should actually be printLine(c);
main
printLine(char c);
printLine(c);
1.4m articles
1.4m replys
5 comments
57.0k users