Hi everybody,m a beginner ,while trying to execute the following code in the output i can't getthe symbol ( ' ) correctly printed ,plz lemme know where m i at fault-

class Song{
public static void lyrics(int n){

if(n==1){
System.out.println("No bottles of beer on the wall,; no bottles of beer, ya' can?t take one down,ya' can?t pass it around, 'cause there are no more bottles of beer");
}
else{
System.out.println(n+" bottles of beer on the wall," + n + "bottles of beer, ya? take one down, ya?pass it around," + (n-1)+" bottles of beer on the wall.");
lyrics(n-1);
}

When you say that you can not get the quotes printed properly what do you mean?
Is it that none of them are displayed or that there are too many or they are in the wrong place or what?

Also, you will have to repost your original source code using the

tags, the code you posted was reformatted by the forum software.
Just press the *CODE* above the text entry area and paste your original source betwen the tags. Note that I said original the code in the post is already messed up.

That is because ' needs an escape character. Google "java escape character" and learn all about it.

Also, this is a really poor example of recursion. This could have been done much easier and better even using a simple loop. If this is something you came up with to turn in as an example of recursion, I would start over. While technically you are using recursion, there is no reason for it and recursion should never be used as a replacement for the loop, which is exactly what you are doing here.

Finally, if you want to receive help here, there are a few things you can do to not tick off the people you are asking to help. An example that is excusable since you are new here is not using code tags when posting code. Using code tags makes the code much easier to read, thus making people much more willing to read it. But the unexcusable error you have made is using lazy type. Does it really hurt you to type "am" instead of "m", I mean it is like one extra keystroke? You used "m" twice, once for "I'm" and once for "am", and you used "plz" for "please". Now there are is one of two ways this can be taken, either you don't care enough to respect the professionals volunteering their time to help you here by giving slightly more effort on your part to completely spell out the words, or you are allergic to vowels. Since you use vowels in other words, it leaves us only with the first possibility. We are not paid to help you, the least you can do is show a little respect. Your request was an easy one, and I am sure several posters who could have easily answered it simply skipped over it because of the lazy type, I myself would have likely explained it myself instead of telling you what to google if your post hadn't rubbed me wrong.

Thanks for giving your time to my problem.The actual problem is when i execute the code the apostrophe symbol after "ya" and elsewhere in the code doesn't correctly appear in the output rather some strange symbol does appear.

class Song{
public static void lyrics(int n){
if(n==1){
System.out.println("No bottles of beer on the wall,; no bottles of beer, ya' can?t take one down,ya' can?t pass it around, 'cause there are no more bottles of beer");
}
else{
System.out.println(n+" bottles of beer on the wall," + n + "bottles of beer, ya? take one down, ya?pass it around," + (n-1)+" bottles of beer on the wall.");
lyrics(n-1);
}
}
public static void main(String[] args)
{
lyrics(3);
}
}

Thanks for giving your precious time to my problem.I never meant to hurt anybody or waste someone's time,neither i know who is paid and who is not.I would never make mistakes knowingly just because someone is getting paid.But if i unknowingly did something wrong am sorry.
I used recursion because it was a question somewhere to use recursion for this and in the output at some places i got the symbol printed and at some not.By the way m learning it since last two days so forgive me for some silly mistakes in my codes.

class Song{
public static void lyrics(int n){
if(n==1){
System.out.println("No bottles of beer on the wall,; no bottles of beer, ya' can?t take one down,ya' can?t pass it around, 'cause there are no more bottles of beer");
}
else{
System.out.println(n+" bottles of beer on the wall," + n + "bottles of beer, ya? take one down, ya?pass it around," + (n-1)+" bottles of beer on the wall.");
lyrics(n-1);
}
}
public static void main(String[] args)
{
lyrics(3);
}
}