answersLogoWhite

0


Best Answer

class demo {

public static void main(String[] args) { if(args.length == 2) {

System.out.println(args[0] + args[1]);

} else {

System.out.println("Usage: demo Str1 Str2");

}

}

User Avatar

Wiki User

15y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

12y ago

import java.util.*;

public class Example

{

public static void main(String[] args)

{

Scanner in = new Scanner(System.in);

String one = "hello";

String two = "goodbye";

String combined = one+two;

System.out.println(combined);

}

}

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

Here is a program that does as asked two separate ways: public class Example

{

public static void main(String[] args)

{

String q1 = "hello";

String q2 = " goodbye";

String finalString = q1+q2;

System.out.println(q1 + " concatenated with" + q2 + " yields: " + finalString);

String returned = concatenateStrings("hello", " How are you?");

System.out.println(returned);

}

public static String concatenateStrings(String a, String b)

{

String concatenated = a+b;

return concatenated;

}

}

In the "related links section" I have put a video I made further explaining the above code.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Create a program in java that will accept 2 strings and display in concatenated form?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Which program do you create a graph?

You can use MS Excel to create a graph from data in the spreadsheet or from an external source. You also can display a graph with MS Powerpoint. MS Word can display a graph, but usually does not create it.


Is Html an example of an HTML program?

HTML is not a program it is a langue your computer speaks with the browser to create arguments and display data


How do you create program that display your name?

#include<stdio.h> #include<conio.h> void main() { clrscr(); printf("Your name here"); getch(); }


What is the difference between nylon strings and steel strings?

Nylon strings are for beginners, whilst steel strings are harder wearing on your fingers but create a nicer sound.


How do you create a program that will display output?

It must use a function with a "return" statement. Or you could output via console. (.NET CODE(C#)) Console.WriteLine("Output.");


How do you create program using characters strings in turbo c?

#include int main (int argc, char **argv){printf ("The name of this program is %s\n", argv[0]);return 0;}There's two character-string in this program, a literal and a variable. Go find them.


How are Low sounds made with vibrating strings?

The strings must be vibrating slowly but widely to create a low note.


What category is the piano?

Piano is considered both percussion and strings. Percussion because of the mallets having to hit the strings Strings because of the wire inside being struck to create the noise.


What are the two ways strings can be combined to create a new string?

Concat()


Do you think strings could create singularity?

Definitely. I'm sure of it.


Create a flowchart that will display my name?

ana


What is two family members of a piano?

Both percussion (because of the mallets) and the strings (because of the strings being struck to create the noise or music)