Click here to Skip to main content
15,868,141 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.


https://bytes.com/attachments/attachment/9837d1546111096/dunno-if-there-has-problem-strings.jpg[^]


Java
package com.company;

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.
Posted
Updated 29-Dec-18 22:42pm
v2

1 solution

Java
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.
 
Share this answer
 
Comments
cod&doc 30-Dec-18 16:48pm    
https://bytes.com/attachments/attachment/9838d1546206370/norightsolution.jpg[^]


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