Anonymous
Anonymous asked in Computers & InternetProgramming & Design · 1 decade ago

Java Lowercase char string?

Need to make this lowercase because when I spell my name, Ryan Blah (lol), it turns into halB nayR and I need the R and the B lowercase.

import java.io.*;

import java.util.Scanner;

public class NameReversal {

/**

* @param args

*/

public static void main(String[] args) {

Scanner kbReader = new Scanner(System.in);

System.out.println("Please Type Name _");

String n = kbReader.nextLine();

n.toLowerCase();

char []chr;

chr = n.toCharArray();

for(int i=n.length()-1; i>=0; i--)

System.out.print(chr[i]);

}

}

Thats my code so far, please help.

2 Answers

Relevance
  • 1 decade ago
    Favorite Answer

    n = n.toLowerCase();

    You're not assigning it back.

    Source(s): Software Architect
  • Anonymous
    4 years ago

    you are able to adjust the toLowerCase() line to be : n = n.toLowerCase(); appropriate now, you're changing it to decrease case, yet in no way incredibly saving it into the variable "n" for use later.

Still have questions? Get your answers by asking now.