Search the courses, subjects, tracks, games and features, or jump straight to a page.
2 cards from this section. Quick, good the night before a test.
What does the method charAt() do?
Think about how you access elements in an array.
How do you determine the length of a string?
It's a method that gives you the number of characters.
What does the length() method do in a string?
It's a method that counts.
True or false: The index of the first character in a string is 1.
Check where indexing starts.
Write a Java program that takes a string input from the user and prints each character with its corresponding index. The code editor sends no keyboard input, so store a sample string, such as "Java", in a variable in place of the user's input.
Store the sample input in a String variable and remember to build a proper for loop.
How would you modify the program to skip vowels while printing the characters?
Think about using conditional statements to filter out characters based on their properties.
5 more questions in this section. Enroll free to practise them all.
Enroll free