+ 1
can you change return type of main method ? like int, char or float
4 ответов
+ 6
main has nowhere to return data.
+ 2
No, the return type of main() method must be void only. If the return type is anything else the compilation will be sucessful. But, you can’t run the java program. You will get run time error as main method not found.
+ 2
main mathod return type must be void and it must be declared as static
+ 2
yes, but if we are overloading the main method
i.e.
class Program{
public static void main(String[] args){
System.out.println(main(5)); //5
}
public static int main(int a){
return a;
}
}