Menu Close

Concatenate Strings

Write a java program to print concatenated strings . You can + operator to concatenate strings and print it.

Input:     // two inputs
Enter the strings:
I am
Fine

Output:
I am Fine
import java.io.*;
import java.util.Scanner;
public class temp{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    String a,b;
    System.out.println("Enter the Strings:  ");
    a = scan.nextLine();
    b = scan.nextLine();
    System.out.println(a+" "+b);
	}
}

INPUT_1:
Enter the Strings:
I am
Fine

OUTPUT:
I am Fine


INPUT_2:
Enter the Strings:
fcuk
the code

OUTPUT:
fcuk the code


INPUT_3:
Enter the Strings:
I am
almighty Overlord

OUTPUT:
I am almighty Overlord


INPUT_4:
Enter the Strings:
Hello
World

OUTPUT:
Hello World


INPUT_5:
Enter the Strings:
Hello
Metaverse, its the new Hello World Program nowadays!!!

OUTPUT:
Hello Metaverse, its the new Hello World Program nowadays!!!


ILLUSTRATION

Executed using javac in linux Terminal

Morae Q!

  1. Convert from binary number to decimal number.
  2. Swap two numbers by using division and multiplication.
  3. Compute foot and inches into centimetres.
  4. Concatenate Strings.
  5. Convert lowercase letters to uppercase letters.
  6. Compute the sum of all the digits of N.
  7. Compute the area of the pentagon.
  8.  Get input using scanner.
  9. Find the distance between two points (x1,y1) and (x2,y2).
  10. Finding patterns in a file using frep and egrep .
  11. Detecting a cycle in a directed graph using Depth First Traversal.
  12. Topological ordering in a Graph.
  13. Storing graphs using adjacency list.
  14. Introduction to graph theory.
  15. Graph Adjacency Matrix pseudo code.
  16. Adjacency Matrix for storing graphs.
  17. Dijkstra’s shortest path algorithm .
  18. Breadth first search (BFS) Algorithm.
  19. Find the multiple of given number in the list of integers.
  20. Finding patterns in files using grep .