Can "main" in java return a String?
java, program-entry-point, return, string
Solution
In short - no, it can't. You can always print to stdout from the main method (using `System.out.print` or `System.out.println`), but you can't change the return type of `main`.
Problem
Is it possible that public static void main(String[] args) in java returns `String` instead of `void`? If yes, how? ``` public static String main(String[] args) ``` instead of: ``` public static void main(String[] args) ``` when I change my code as below: ``` public static String main(String[] args) throws IOException { String str = null; TurkishMorphParser parser = TurkishMorphParser.createWithDefaults(); str = new Stm(parser).parse("bizler"); System.out.println("str = " + str); String replace = str.replace("[",""); String replace1 = replace.replace("]",""); List<String> result1 = new ArrayList<String>(Arrays.asList(replace1.split(","))); String result = result1.get(0); System.out.println("Result = " + result); return result; } ``` I receive this error: ``` Error: Main method must return a value of type void in class Stm, please define the main method as: public static void main(String[] args) ```