Explore the topics covered in the Functions lesson and enhance your programming skills by completing the included programming exercises.

Practice exercises

1

Function greeting and farewell

Develop your Java skills by creating a program with greeting and farewell functions. Learn to execute methods effectively from the main function (Main).

2

Greet and bid farewell with parameters

Create a Java program that implements two methods for greeting and saying goodbye. The greeting method should have a text parameter.

3

Check alphabetical string

Create a Java program that implements a function called 'isAlphabetic()' which takes a text parameter from the user and checks if the text contains alphabetic characters from 'a' to 'z', including both uppercase and lowercase.

4

Replace character in a string

Explore text manipulation in Java with this intermediate-level exercise. Implement the changeLetter() function to modify a character in a text. Learn practically and enhance your mastery in programming!

5

Function sum

Create a Java program that implements a function called "sum" that returns the sum of two integer numbers passed as parameters.

6

Check numeric string

Create a Java program that implements a function called IsNumber that receives a text parameter from the user and check if the text is a number or not.

7

Calculator with command-line parameters

Create a Java program that serves as a calculator with the ability to add, subtract, multiply, or divide.

8

Function count spaces of a text

Create a program in Java that implements a function called CountSpaces that receives as a parameter a text requested from the user.

9

Function to sum the digits of a number

Create a Java program that asks the user for a number and save it in a text string.

10

Return value from Main

Create a new version of the program Main parameter calculator where you can return the following error codes from Main.

11

Find the minimum and maximum in an array

Create a Java program that implements a function called FindMinMax that receives three parameters, an array of real numbers and two real numbers.

12

Function to write format text

Create a program in Java that implements a function called WriteCenteredUnderline that receives as a parameter a text requested from the user.

13

Function to add an array of integers

Create a Java program that asks the user for 5 integers to store them in an array of integers.

14

Function to show an inverted string

Create a Java program that implements a function called InvertString receive receive a text by parameter and display them in reverse order.

15

Calculate double a number

Create a Java program that implements a function called Double to calculate and return double an integer.

16

Function to check palindrome

Create a Java program that implements a function to check if a string is a palindrome or not.

17

Search the greatest value in an array

Create a program in Java that implements a function called SearchGreatestValue that receives as an parameter an array of 5 real numbers requested from the user.

18

Function to calculate the power of a number

Create a Java program that implements a function called Power and calculate the result of raising an integer to another number.

19

Function to write text with title format

Create a Java program that implements a function called WriteTitle that writes a text centered on the screen, in capital letters, with additional spaces and with one line above and another below.

Java Course Lessons

Discover all the lessons included in the Java programming course. Complete all the exercises and learn to program by programming.

Social networks

Help us to share free knowledge and programming in the world.

Keep learning

C# Programming Course

Free programming course with practical exercises and solutions in C#. Start learning right now!

Exercises C# App

Take your Exercises C# lessons everywhere with our Android app. Download it now from Google Play