// 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);
}
}
amitahlawat20
0
Light Poster
Recommended Answers
Jump to PostI 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?
All 2 Replies
javaAddict
900
Nearly a Senior Poster
Team Colleague
Featured Poster
masijade
1,351
Industrious Poster
Team Colleague
Featured Poster
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.