Untitled

mail@pastecode.io avatar
unknown
java
a year ago
641 B
0
Indexable
Never
package Labs.Assignment4.PartTwo;
import java.util.*;

public class QuestionFourPointTwenty 
{
    public static void main(String[] args) 
    {
        Scanner scanner = new Scanner(System.in);
        //Prompt User to Enter a String
        String userString = scanner.nextLine();

        // Find the length and assign it to a varibale 
        int stringSize = userString.length();

        // find the last character in the string
        char lastChar = userString.charAt(stringSize-1);

        System.out.printf("The length of the string is %d and the last character is %c", stringSize, lastChar);

        scanner.close();


    }
}