i can not understanding the error of this program

interface Test
{

    void show();
    void input();
    void square();
}
class Run implements Test 
{

    int a,b,c;

    void show()
    {

        System.out.println("a = " + a);
        System.out.println("b = " + b);
        System.out.println("c = " + c);
    }
    void input()
    {

        a=2;
        b=3;
        c=4;
    }
    void square()
    {

        System.out.println("a = " + a*a);
        System.out.println("b = " + b*b);
        System.out.println("c = " + c*c);
    }


}
class Interface
{

    public static void main(String s[])
    {

        Ruu obj=new Run();
        obj.input();
        obj.show();
        obj.square();
        obj.show();

    }
}

Recommended Answers

All 8 Replies

You have been posting here long enough to know that you should give the complete details of any error messages, and explain what symptoms you are seeing.
ps CHECK YOUR SPELLING (AGAIN)

There is already something named Interface!
Try to replace the class name with another name!

what kind of error you show mention it

There is already something named Interface!

Are you sure? There is a keyword "interface" but that's irrelevant. I don't see anything else called "Interface"

this 'll cause trouble, though
Ruu obj=new Run();

typo's in code is the easiest way to get it to crash during compilation

Yes, as in my "check your spelling". OP's previous thread was a similar typo, so he should be able to understand a "cannot find symbol" error by now.

Ooops, looks like i read it wrong(it seemed to me you wrote your class and your interface with the same name).
So, the error is here:

Ruu obj = new Run();

Since class Ruu is not defined.

when you implement an interface method it must be declared as public and this was my ERROR bye bye

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.