ControlC
· Pastebin
Login
Register
ControlC
/
Create paste
Paste content
Up to 100 KB of text. BBCode formatting is supported.
Title
- optional
Content
B
I
U
S
</>
Colors ↓
Sizes ↓
Size 1
Size 2
Size 3
Size 4
Size 5
Size 6
Size 7
public class SampleConversion{\r\n\r\n public static void main(String[]args){\r\n short s1 = 50;\r\n \r\n //valid\r\n int intOne = s1 + 100;\r\n \r\n //error: possible lossy conversion\r\n //from int to short 'cause the\r\n //result is int\r\n //short s2 = s1 + 100;\r\n \r\n //invalid\r\n //result is converted to int\r\n //byte b1 = 25;\r\n //short s1 = 50;\r\n //byte b2 = b1 + s1;\r\n \r\n //valid\r\n //result is long since long\r\n //has higher bits than int\r\n long longOne = 100 + 100L;\r\n //invalid\r\n //int intOne = 100 + 100L;\r\n \r\n //valid\r\n int intTwo = 'c' + 5;\r\n \r\n //if char and an integer literal\r\n //are both operands in one operation\r\n //and the result is gonna be stored\r\n //in a char variable then, the result\r\n //is gonna be char type\r\n \r\n //valid\r\n char character = 'c' + 5;\r\n \r\n //invalid\r\n //int intOne = 5;\r\n //char character = 'c' + intOne;\r\n \r\n }\r\n}
Password
Anyone with the link will still need this password to view.
Expires
1 hour
3 hours
6 hours
12 hours
24 hours
48 hours
72 hours
Sign in to enable "Never expires".
Create paste
Please verify you are human
Cancel