0

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();

    }
}
5
Contributors
8
Replies
26
Views
3 Years
Discussion Span
Last Post by moaz.amin.37
0

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)

0

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

0

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"

0

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

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

0

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.

0

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.

0

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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.