Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.61 KB | None | 0 0
  1. //This program is for assignment #7 question #3
  2. import java.util.Scanner;
  3. public class ShowChar
  4. {
  5.   public static void main(String [] args)
  6.   {
  7.     Scanner s = new Scanner(System.in);
  8.     System.out.println("Please enter the String");
  9.     String input =s.nextLine();
  10.     System.out.println("Please enter the Character Position you would like to find from the string");
  11.     int pos =s.nextInt();
  12.     Char position = showChar(input,pos);
  13.     System.out.println(position);
  14.   }
  15.  
  16.   public static Char showChar(String name,int place)
  17.   {
  18.     char position = name.CharAt(place);
  19.     return position;
  20.   }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement