Advertisement
thenewboston

Java Programming Tutorial - 15 - Use Methods with Parameters

Aug 22nd, 2014
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.44 KB | None | 0 0
  1. import java.util.Scanner;
  2. class apples{
  3.    public static void main(String args[]){
  4.    
  5.       Scanner input = new Scanner(System.in);
  6.       tuna tunaObject = new tuna();
  7.      
  8.       System.out.println("Enter your name here: ");
  9.       String name = input.nextLine();
  10.      
  11.       tunaObject.simpleMessage(name);
  12.  
  13.    }
  14. }
  15.  
  16.  
  17. public class tuna {
  18.    public void simpleMessage(String name){
  19.       System.out.println("Hello " + name);
  20.    }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement