write a small Java application in a class named AppDemoTwo that contains a metho
ID: 638204 • Letter: W
Question
write a small Java application in a class named AppDemoTwo that contains a method named concatenateStrings. The concatenateStrings method should accept a varargs argument of the string type. The method should concatenate the strings referenced by the varargs parameter and return the concatenated string. (NOTE: the application does not need to read input from the console. Write code in the main method that invokes the concatenateStrings method with various values, and output the results to the console) write a small Java application in a class named AppDemoTwo that contains a method named concatenateStrings. The concatenateStrings method should accept a varargs argument of the string type. The method should concatenate the strings referenced by the varargs parameter and return the concatenated string. (NOTE: the application does not need to read input from the console. Write code in the main method that invokes the concatenateStrings method with various values, and output the results to the console) (NOTE: the application does not need to read input from the console. Write code in the main method that invokes the concatenateStrings method with various values, and output the results to the console)Explanation / Answer
public class AppDemoTwo
{
public String str="Java";
public void concatenateStrings( String str1)
{
String str2="Hello";
System.out.println(str2+" "+concat(str1));
}
public static void main(String[] args)
{
AppDemo app=new AppDemo();
app.concateStrings();
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.