This is my code:
package com.codegym.task.task03.task0312;
/*
Time conversion
*/
public class Solution {
//write your code here
public static int convertToSeconds(int hour){
return hour*60*60;
}
}
public static void main(String[] args) {
//write your code here
System.out.println(convertToSeconds(10));
System.out.println(convertToSeconds(20));
}
}
Issue: The compiler is mad!
com/codegym/task/task03/task0312/Solution.java:15: error: class, interface, or enum
expected
public static void main(String[] args) {
^
com/codegym/task/task03/task0312/Solution.java:18: error: class, interface, or enum expected
System.out.println(convertToSeconds(20));
^
com/codegym/task/task03/task0312/Solution.java:20: error: class, interface, or enum expected
}
^
Please explain.
Why wont the compiler accept it?
Resolved
Comments (2)
- Popular
- New
- Old
You must be signed in to leave a comment
Gëzim Qaili
28 January 2019, 09:03
public class Solution {
//write your code here
public static int convertToSeconds(int hour){
return hour*60*60;
}
} <<< this is an extra curly brace. You have to remove it.
0
Guadalupe Gagnon
21 January 2019, 20:26
looks like you have an extra curly boy ( } ) after your return statement.
remember that you dont need to, and actually should not, copy and paste code into questions. Just use the slide bar and it will add your code along with task requirements for our reading pleasure:
.
![]()

0