package com.codegym.task.task03.task0312;
/*
Time conversion
*/
public class Solution {
public static int converToSeconds(int hour);
int s = hour * 3600;
return s;
}
public static void main(String[] args) {
System.out.println(converToSeconds(1));
System.our.println(converToSeconds(2));
}
}
I typed the return statment but why does it not see the return? it says illegal start type
Under discussion
Comments (4)
- Popular
- New
- Old
You must be signed in to leave a comment
J H U X
11 January 2021, 10:02
You typed: public static int converToSeconds(int hour);
But it should be: public static int convertToSeconds(int hour) {
There is a type too in convertToSeconds on which CodeGym will say you failed the test, although it would've worked in the real world.
Another typo in the second System.out.println.
Good luck!
0
Sujit Mahato
5 September 2020, 17:33
you take semicolon " ;" after declare method
make it correct as
public static int convertToSecends(int hour) after this if you take semicolon " ; ".
then program should be given error .
0
Gellert Varga
5 May 2020, 22:07useful
Line 9: To declare a method is not like this:
converToSeconds(...);
it seems like a command.
Method declaration is like this:
converToSeconds(...)
(curly brucket!)
Line 16: 'our' or 'out' ? :)
+1
Gellert Varga
5 May 2020, 22:08
+2