Hey whoever was good enough to take a look at this thread I have to stress I am a complete noob!
I picked up "Java programming for the complete beginner" five days ago and here I am with 50% less hair and stuck on a challenge at the end of chapter 2!:sad:
My problem is the sparse table in the book re String class methods.All I have is a page with 17 methods and a brief description,no worked examples etc.
Here is the code I've been trying to compile for two days,in its latest re-jig.
echo"
/*Letters.java*/
/*I'm trying to create a program that capitalises the first letter of the user-defined input
and parses the rest to lower case then adds a "." at the end(Java Programming for complete
beginners pg 69 challenge 4)*/
import java.io.*;
public class Letters {
public static void main(String args[]) {
String value = "",
carA = "",
restA = "";//strings loaded
BufferedReader reader;
reader = new BufferedReader(new InputStreamReader(System.in)); //the usual
try {
System.out.println("Please type a word :\t");
value = reader.readLine();
}
catch(IOException ioe) {
System.out.println("IO ERROR");
}
carA = value;
value = value.charAt(0);//these lines are my problem according to javac
restA = carA.substring(1);//"found char, required java.lang.String"
System.out.println(carA.toUpperCase() + restA.toLowerCase() + ".");
}
}";