Function with parameters - Practice Exercises Java Lesson 5: Functions Exercise 5.2: Function with parameters Objetive: Create a program whose Main must be like this: public static void Main() { SayHello("John"); SayGoodbye(); } SayHello and SayGoodbye are functions that you must define and that will be called from inside Main. As you can see in the example. SayHello must accept an string as a parameter. Source Code: JAVA C# public class Main { public static void SayHello(String name) { System.out.println("Hello" + name); } public static void SayGoodBye() { System.out.println("Adios"); } public static void main(String[] args) { SayHello("Jonh"); SayGoodBye(); } } Copy Exercise to ClipBoard Copy Code to ClipBoard Exercisey 5.2
More exercises for Lesson 5 Previous Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 Next >>