String Concatenation in Java

Download
Download is available until [expire_date]
  • Version
  • Download 16
  • File Size 2.46 KB
  • File Count 1
  • Create Date April 18, 2016
  • Last Updated April 18, 2016

String Concatenation in Java

String Concatenation in Java

Concatenation is joining or combining two or more strings. In this java program, we are going to combine two strings to form a single one. This program will accept inputs from the user using the scanner class. It’s available in console and gui version.

Source code:

import javax.swing.*;
class ConcatStringGUI
{ 
public static void main(String[] args) {
	 
String firstname ; 
String lastname ;

firstname = JOptionPane.showInputDialog(null,"Enter your firstname:");
lastname = JOptionPane.showInputDialog(null,"Enter your lastname:");

JOptionPane.showMessageDialog(null,"Your fullname:" + firstname + lastname);

	}
}
, , , , , ,

Post navigation

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.