Java #27: How to Pass and Transform Strings from Function to Function in Java

//Programmer: Akinwale Owi
//Company: Dagba Computers
//Program Purpose: Pass a String to and From a Function
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.


* @author Akin
public class DagbaComputerSample {

* @param args the command line arguments
public static void main(String[] args) {
//String we will be passing
String first = “Dagba”;

//Sending and Printing the string to the function
System.out.println(“I could eat some “+ Pasta(first) + ” right about now”);
}//end of main

//Function that will be receiving the string
public static String Pasta (String first)
//String that holds the first string variable from the Main Function
String beforeTransform = first;
//String created in this function that adds Bacon
String afterTransform = first + ” Bacon”;

//Sending back the new String Variable
return afterTransform;
}//end of pasta
}//end of DagbaComputerSample Class

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s