Hai everyone, I am a beginner in java programming and I need help, I have a java programming question which i am tryg to find literation code. I cant seem to get it right. Can anybody help me to solve the problem? I have been tryg to find the answer for almost a week now. Please help me.. Thank you..
The question:
public class AssignmentQ2{
public static String repeat(char C1,char C2, int n){
String result = "";
if (n== 0) {
return "";}
else if(n%2==0) {
result = result + repeat(C1,C2, n-1)+C2;
}
else {
result = result + repeat(C1,C2, n-1)+C1;
}
return result;
}
public static void main(String[] args){
String rpt = repeat('a','b',6);
System.out.println(rpt);
}
}