Print Concatenated Strings
This program prints concatenated strings.
Problem Statement
Write a Java program that concatenates and prints two strings.
Source Code
| 1 | public class Concatenate { |
| 2 | public static void main(String[] args) { |
| 3 | String first = "Eduinq"; |
| 4 | String second = "Programs"; |
| 5 | System.out.println(first + " " + second); |
| 6 | } |
| 7 | } |
Program Output
Eduinq Programs
Explanation
Two string variables, first and second, are declared and joined together using the + operator along with a space in between, then printed, demonstrating string concatenation.