import java.util.Scanner;

public class Name
{
  String lastName;
  String firstName;
  Scanner scan = new Scanner(System.in);

  public Name(String LastName, String FirstName)
  {
      lastName = LastName;
      firstName =FirstName;
  };

   public String getFirstName()
  {
      return firstName;
  }

  public void setFirstName (String FirstName)
  {
      firstName = FirstName;
  }

  public String getLastName()
  {
      return lastName;
  }

  public void setLastName (String LastName)
  {
      lastName = LastName;
  }

  public String toString()
  {
      String name = ("name: " + this.getLastName()+ ", " +this.getFirstName());
      return name;
  }

}

oh and variable sysmbol required is the error message

I don't get any compiler error when trying to compile the piece of code that you've posted.
Please post the piece of code that results in the compiler error you've described.

why do you have this: : here in your code?

public Name(String LastName, String FirstName)
  {
      lastName = LastName;
      firstName =FirstName;
  };

@stultuske:-This is a constructor.What is your doubt about this line i am not clear.

@Chevane:- I am not geting any error.Are you calling it properly.Because you have created constructor and there is no default constructor o you have to pass proper parameters.

Eg:-

    Name name = new Name("sad","das");
    System.out.println(name.toString());

I checked this and it is working fine.

my doubt is that right after his constructor, he has a ; which shouldn't be there.
when debugging, don't look for the obvious, look for that what is either missing, or shouldn't be there at all.

my doubt is that right after his constructor, he has a ; which shouldn't be there.

While it doesn't seem to be generally used, it is valid syntax.
As I implied by my previous post there's nothing wrong with it since it compiles perfectly.
You could argue that it might be a bug in the compiler, but I will support my statement by quoting the relevant section(s) of the Java Language Specification:

ClassMemberDeclaration:
        FieldDeclaration
        MethodDeclaration
        ClassDeclaration                        
        InterfaceDeclaration
        ; // semicolon is a valid ClassMemberDeclaration

(Source: JLS - 8.1.6 Class Body and Member Declarations)

Therefore you could write syntactically valid code like:

public class Test
{
    private int a;

    public Test(int a)
    {
        this.a = a;
    };; // [1]

    public int getA()
    {
        return a;
    }; // [1]

    public static void main(String[] args)
    {
        System.out.println(new Test(15).getA());
        ;;;;;; // [2]
    }; // [1]
}; // [3]

; // [3]
; // [3]
; // [3]
 ;;;; ;; // [3]

class B
{
}

Lines marked by a [1] are valid as of: JLS - 8.1.6 Class Body and Member Declarations)

ClassMemberDeclaration:
        FieldDeclaration
        MethodDeclaration
        ClassDeclaration                        
        InterfaceDeclaration
        ;

Lines marked by a [2] are valid as of: JLS - 14.6 The Empty Statement

EmptyStatement:
        ;

Lines marked by a [3] are valid as of: JLS - 7.6 Top Level Type Declarations

TypeDeclaration:
        ClassDeclaration
        InterfaceDeclaration
        ;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.