A PHP Error was encountered

Severity: 8192

Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

Filename: libraries/Filtered_db.php

Line Number: 23

Java program to concatenate two strings without using library function
Q:

Java program to concatenate two strings without using library function

0

Java program to concatenate two strings without using library function

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Program to concatenate two strings without using library function in java

import java.util.Scanner;

class ConcatenateString{
	public static void main(String[] args){
		/* create Scanner class object */
		Scanner sc = new Scanner(System.in);
		
		/* Display message for user to take first 
		string input from keyboard */
		System.out.println("Enter First String :");
		String firstStr = sc.next();
		
		/* Display message for user to take first 
		string input from keyboard */
		System.out.println("Enter Second String :");
		String secondStr = sc.next();
		
		/* Display message for displaying result */
		System.out.println("Result after concatenation:");
		
		/* '+' operator concatenate string */
		System.out.println(firstStr+ " " + secondStr);
	}
}

Output

D:\Java Articles>java ConcatenateString
Enter First String :
preeti
Enter Second String :
jain
Result after concatenation:
preeti jain

 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now