Answer:
public static String repeat(String text, int repeatCount) {
if(repeatCount < 0) {
throw new IllegalArgumentException("repeat count should be either 0 or a positive value");
}
if(repeatCount == 0) {
return "";
} else {
return text + repeat(text, repeatCount-1);
}
}
Explanation:
Here repeatCount is an int value.
at first we will check if repeatCount is non negative number and if it is code will throw exception.
If the value is 0 then we will return ""
If the value is >0 then recursive function is called again untill the repeatCount value is 0.
Answer:
public class TestImport{
public static void main(String[] args) {
String string1 = args[1];
String string2 = args[2];
System.out.println(string1 +" " +string2);
}
}
Explanation:
The solution here is to use string concatenation as has been used in this statement System.out.println(string1 +" " +string2);
When this code is run from the command line and passed atleast three command line arguments for index 0,1,2 respectively, the print statment will return the second string (that is index1) and the third argument(that is index2) with a space in-between the two string.
Answer:
a submenu
Explanation:
a menu inside a menu is called a submenu or recursive menu
It was not. Movies then talking movies were before television.