A simple program to ask the user to give a string and then the program will identify the first and last character in the given string by the user using Java programming language.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

Program Listing

 * @author Jake Rodriguez Pomperada, MAED-IT, MIT
 * jakerpomperada@gmail.com
 * www.jakerpomperada.com
 * Bacolod City, Negros Occidental
 * March 8, 2021 Monday

import java.util.*;

class First_Last_Character {  
    public static void main(String[] args) {  
    	Scanner sc = new Scanner(System.in);
    	  char ch1,ch2;
    	  String str;
    	  String reply = "";
        do {
 	    System.out.print("\t\tFirst and Last Character in Java");
 	    System.out.print("\tEnter a string: ");  
        str = sc.nextLine();
        ch1 = str.charAt(0);
        ch2 = str.charAt(str.length() - 1);
        System.out.println("\tThe first character of the string is: " + ch1);             
        System.out.println("\tThe last character of the string is: " + ch2);
        System.out.print("\tDo you want to continue (Type Y - Yes or N - No) : ");
        reply = sc.nextLine();

          System.out.print("\t THANK YOU FOR USING THIS PROGRAM");