Created
September 15, 2008 17:39
-
-
Save ELLIOTTCABLE/10899 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Mon Sep 15 - 09:36:15] [elliottcable @ Geoffrey] [~/Code/school/] | |
-- javac Exercises.java && java Exercises | |
Exercises.java:11: cannot find symbol | |
symbol : method getCharAt(int) | |
location: class java.lang.String | |
char last_character = input.getCharAt(last_char_index); | |
^ | |
1 error | |
[Mon Sep 15 - 09:42:34] [elliottcable @ Geoffrey] [~/Code/school/] | |
-- | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class Exercises { | |
static Scanner keyboard = new Scanner(System.in); | |
public static void main(String[] args) { | |
System.out.println("Hello! Say something..."); | |
String input = keyboard.next(); | |
int last_char_index = input.length() - 1; | |
char last_character = input.getCharAt(last_char_index); | |
System.out.println(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment