This project demonstrates string concatenation in Java. It shows how to combine multiple object types (String) into a single output using the + operator.
As per the assignment instructions:
- Create two
Stringvariables:firstName("Luke") andlastName("Skywalker"). - Combine them into one string with a space in between.
- Display the full name on the screen.
After running the program, the console should display:
Luke Skywalker
- Language: Java 23
- IDE: IntelliJ IDEA
- Concepts: String concatenation, Object types, Variable initialization.
The project highlights that strings in Java are immutable. When we use the + operator, Java creates a completely new string object in the String Pool (or Heap) to store the combined result.
package com.yurii.pavlenko;
public class Task_13_App {
public static void main(String[] args) {
// Initializing object types (Strings)
String firstName = "Luke";
String lastName = "Skywalker";
// Concatenating strings with a space in between
String fullName = firstName + " " + lastName;
// Outputting the result
System.out.println(fullName);
}
}This project is licensed under the MIT License.
Copyright (c) 2026 Yurii Pavlenko
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files...
License: MIT