Break the problem up into separate steps and do one step at a time.
For example: prompt for a sentence and read in the sentence and print it out.
See the Scanner class for a way to read in a sentence. Many code samples on this forum if you use Search.
public class LetterCount
public static void main (String  args)
int freq = 0; // frequency of charactersdeclared and initialised to zero
String lineTwo ; //string called lineTwo initialised.
System.out.println("Enter a string of text;\n"); // prompt user for the a string of text.
lineTwo = input.nextLine(); // read text from user.
System.out.println ("Enter letter"); // prompt user to enter a letter
// in which they would like to find
// out how many times its appearing.
String letter = input.nextLine(); // get line of text from user
for (int i = 0; i<lineTwo.length(); i++) //iterate through the line of text up the length of the text entered.
if (lineTwo.charAt(i) == letter.charAt(0)) // compare the character at i
// from the first line and character that the user inputs
freq++; // increment the frquency by 1 if the comparison in the of statement is equal.
if ((lineTwo.length()-1) == i) // compare
System.out.printf("%s \t %d", letter, freq ); // print the letter and how many times its appearing.
System.out.printf("\n\n"); // print two lines.
For Each ctrl As Control In Me.Controls("pnlMainPanel").Controls
If ctrl.GetType Is GetType(System.Windows.Forms.Panel) Then
For Each subCtrl As Control In ctrl.Controls
If subCtrl.GetType Is GetType(System.Windows.Forms.TextBox) Then
If subCtrl.GetType Is ...