Please enable JavaScript to use CodeHS

CodeHS Glossary


Return type Java

A method's return type is the type of value returned from that method. The return type is written right before the method name. If no value is returned from the method, `void` should be the return type. ``` // This method has a return type of int private int sum(int one, int two) { return one + two; } // This method doesn't return a value, so its return type is void private void run() { int result = sum(5, 4); System.out.println(result); } ```