Need help with Java code


For this program supposed to enter a word and number then it will tell you the letter in the word at the number you entered

In word “hello”, the letter at index 3 is “l”

everything should be solid, but im super new so if you see something let me know, the teacher said its good so far i just dont know what to fill in the ???s with…

import java.util.Scanner;

public class LetterAt {
    public static void main(String[] args) {
	    Scanner in = new Scanner(;
	    String word;
	    int index;
		System.out.println("Enter word: ");
	        word =;
		System.out.println("Enter index: ");
		index =; 
	        if (index >= word.??? && index < word.???) {
		        System.out.printf("In word \"%s\", the letter " + " at index %d is '%c'.\n", word);
		else {
	            System.out.printf("%d is not a legal index " + "for \"%s\".\n", index, word);	


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.