0
// 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);
    }
}

Edited by mike_2000_17: Fixed formatting

3
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by masijade
0

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?

0

// 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.

This topic has been dead for over six months. 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.