helow everyone!when i execute the following code,i have saved it as validateInfo.java it tells me that line 5:duplicate class:validateInfo.Please help

public interface validateInfo 
{ 
    public void validate(String empcode, String password); 
} 
class validateInfo implements validateInfo 
{ 
    public void update() 
    { 
        //code to update information of customer 
    } 
    public static void main(String a1[]) 
    { 
updateInfo o= new updateInfo(); 
p.update(); 
        System.out.println("Information updated"); 
    } 
}

You have a class and an interface with the same name, and that's not allowed.
ps: Java convention is that interface and class names should begin with a capital letter.

Use code tags. And the error says: line 5. How are we suppose to know which is line 5 the way you posted. Try next time to show where that line is.
Press the button (code) when you create a post and put your code inside.

Also the problem is: class validateInfo implements validateInfo
The class names must be unique. You cannot have 2 classes with the same name. And when I say classes, I mean java files. You must use different file names and class names for each file. Change the validateInfo file's name to something else. And do the same inside the code. For example:

validateInfo.java
ValidateInfoImpl.java

You should try this:

class ValidateInfoImpl implements validateInfo {
....
}

Also in your main you do this:

updateInfo o= new updateInfo()

And I don't see where you have the updateInfo class defined. I think you should do this:

class ValidateInfoImpl implements validateInfo
{

 public void update()
 {
   //code to update information of customer
 }

 public static void main(String a1[])
 {
    ValidateInfoImpl o = new ValidateInfoImpl();
    o.update();
    System.out.println("Information updated");
 }
} 

And another tip. It is common to have the files start with capital letter.

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.