Reputation: 19
Why the following statements show an error while compiling
int a=10,b=20;
byte c=(a<b)?40:50;
System.out.println(c);
Upvotes: 2
Views: 64
Reputation: 62
b is already declared.
You can try
int a=10,b=20;
byte c=(byte) ((a<b)?40:50);
System.out.println(c);
Upvotes: 3