Use Methods with Parameters

Learn how to Use Methods  with Parameters

Apples Class

import java.util.Scanner;

class apples {
public static void main(String[] args) {

Scanner scanner = new Scanner(;
Tuna tuna = new Tuna();

System.out.println(“Enter your name here”);
String name = scanner.nextLine();



Tuna Class

public class Tuna {
public void simpleMessage(String name){
System.out.println(“Hello ” + name);




Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.