// runtime error encountered , cannot resolve symbol i ,please help!!!

class promote
{
    public static void main(String args[])
    {
        byte b=42;
        char c='a';
        short s=1024;
        int i=50000;
        float f=5.67f;
        double d=.1234;
        double result=(f*b)+(i/c)-(d*s);
        System.out.println( (f*b) + " + " + (i/c) + " - " + (d*s) );
        System.out.println("result = "+result);
    }
}

Recommended Answers

All 2 Replies

I copy-pasted your code and run it and it worked fine. The result I got was:
238.14 + 515 - 126.3616
result = 626.7784146484375
What was your problem?

// runtime error encountered , cannot resolve symbol i

And, besides, that's a compile time error, not a runtime error. It doesn't occur in either case, so this can't be your actual code, or you are actually attempting to compile something else and only think you are attempting to compile this one.

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.