Hi people! My name is Martin Olofsson, I've started learning Java today and I'm just having a few questions that I hope any of you can answer me on. I'm learning Java by a book called "Programmering 1 Java" (written in Swedish) and it's really helpful.
What am I trying to do?
Well, basically I am trying to make the application ask for a character (A-Z) in capital letters and the application should answer in a small letter.
This is what I currently have:
package uppgift.pkg2.pkg8; import java.util.Scanner; public class Uppgift28 { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Insert a character: "); String alpha = input.nextLine(); char tecken = alpha.charAt(0); int kod = (int)tecken + 32; int newKod = (int)kod; String newTecken = Integer.toString(newKod); System.out.println("A small " + alpha + " is a " + newTecken + "."); } }
What is going wrong?
This happens:
I want it to answer in the character (small 'a'), not 97.run: Insert a character: A A small A is a 97. BUILD SUCCESSFULL (total time: 2 seconds)
Is there possibly any helpful genious out there?