Here is the modified version of the classic HelloWorld
program.
class HelloWorld { // line 1
public static void main(String[] args) { // line 2
System.out.println("Hello World!"); // line 3
- Output to console.
String returnValue = getMySite(); // line 4
System.out.println(returnValue); // line 5 Output the
return value
}
public static String getMySite(){ // line 7 -
define function
return "http://javarss.com"; // line 8 - function
return value.
}
}
On line 4, main method calls getMySite function. On
line 8, getMySite returns a value. On line 5, the
returnValue is printed to console (screen).