Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Jason Perry   on Jul 17 In Java Category.

  
Question Answered By: Adal Fischer   on Jul 17

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).

Share: 

 

This Question has 3 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on what is a "return a value" Or get search suggestion and latest updates.


Tagged: