Then im trying to write java program for school. It must be converted to US time, for example 3 PM in European time, 15 in this case. So this is the part where I transition from 24 to 12 AM and return it to the previous method of printing.
if (timeDigit == 0) {timeDigit = 12; String suffix = "AM"; Remove time of return; Return suffix;
But when I try to compile, I get an error: string can not be converted to int
Any ideas how to solve this ?
You can not return twice to the same method twice. When the first withdrawal is given the second name, it will never be executed. The problem is that your method type is coming back and you are trying to return a string.
public int converTime () // If you see that the method is int, which means that it is not an int string return int;
The compiler sees that you are trying to return a string (after returning INL) and say, "O you can not return a string here, I have an int I'm hoping. "
Perhaps you should change your method to return a string and should return both to a statement:
public string converter () {string timedit = "12" ; String suffix = "AM"; String output = null; Output = timidit + suffix; Return output; } Public Zero Main (string AZ []) {string output = convert time (); Println (production); }
Comments
Post a Comment