Click here to Skip to main content
15,065,328 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello, tech people,

I'm newly appeared at the software stage and I don't know more than I know. So, please bare with me and give me some clear guidelines.

I'm trying to code some simple solution of one of my first tasks in Java and I can't find my mistake here. The main reason for writing this code is that I want to print my names with the count of its letters.[^]


public class Main {

    public static void main(String[] args) {
        // write your code here

    String meFirstName = "Smarty";
    String meLastName = "Trousers";
    String meFullName = meFirstName + " " + meLastName;
    int letters = meFullName.length();
    System.out.println("My fullname is " + meFullname + ".");
    System.out.println("My name has" + " " + letters + " " + "letters.");

Thank you for answering!

What I have tried:

To print the full name and also the sum of the letters in it.
Updated 29-Dec-18 22:42pm

1 solution

System.out.println("My fullname is " + meFullname + ".");

Variable names in Java are case sensitive, so you nee to use the same upper and lower case letters in every reference. Your definition is meFullName with upper case N.
cod&doc 30-Dec-18 16:48pm[^]

Unfortunately, error 3 and 8 are still the same. But thank you for your time. :)
Richard MacCutchan 31-Dec-18 2:57am
Firstly, they are not "errors 3 and 8"; that is the line and column number referred to in the error message. I suggest you go to The Java™ Tutorials[^] and learn the Java language first.
cod&doc 31-Dec-18 5:58am
Useless comment, but anyways. Happy New Year!
Richard MacCutchan 31-Dec-18 9:04am
A bit like your useless "error" messages then. But, hey, if you would rather write code without actually learning the language, then good luck to you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900