Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Please help me finish this character count code!

  1. #1
    Junior Member
    Join Date
    Sep 2020
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Please help me finish this character count code!

    import java.util.Scanner;
    public class Names {

    public static void main(String[] args) {
    String firstName;
    String lastName;
    Scanner in = new Scanner(System.in);

    System.out.println("Enter first name: ");
    firstName = in.next(); // next() or nextline()

    System.out.println("Enter last name: ");
    lastName = in.next(); // next() or nextline()



    in.close(); //optional


    }
    }

    So I have this code I am working on ^^ and I need help finishing it, basically after asking for the first name and last name I need the output to count the characters (using charAt) and then to give the initials of the first and last name that are imputed by the user. If you could help me finish off this code that would be amazing!

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Please help me finish this character count code!

    need the output to count the characters
    What have you tried? Where have you tried using the charAt method?
    Can you describe the steps you would take if you were to do the task manually with paper and pencil?

    Please edit your post and wrap your code with code tags:

    [code]
    **YOUR CODE GOES HERE**
    [/code]

    to get highlighting and preserve formatting.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. help finish my code please
    By oonagh in forum What's Wrong With My Code?
    Replies: 3
    Last Post: December 4th, 2012, 12:40 PM
  2. [SOLVED] JTextArea font/character count issue
    By psychobeagle12 in forum AWT / Java Swing
    Replies: 7
    Last Post: April 25th, 2012, 06:17 PM
  3. Finish up code and need some help?
    By erock618 in forum What's Wrong With My Code?
    Replies: 7
    Last Post: April 21st, 2012, 07:33 PM
  4. Character Count Frequently
    By ndundupan in forum What's Wrong With My Code?
    Replies: 3
    Last Post: December 14th, 2011, 09:07 PM
  5. count how frequently each character occurs
    By sam in forum Java Theory & Questions
    Replies: 1
    Last Post: February 19th, 2010, 02:16 PM