int to byte
int i = 234;
byte b = (byte) i;
System.out.println(b); // -22
int i2 = b & 0xFF;
System.out.println(i2); // 234
Brave Bug
int i = 234;
byte b = (byte) i;
System.out.println(b); // -22
int i2 = b & 0xFF;
System.out.println(i2); // 234
public class Person {
public static void main(String args[]) {
int age = 20;
System.out.println("Value of age: " +age);
age = 5 + 3;
System.out.println("Value of age: " +age);
age = age + 1;
age++;
System.out.println("Value of age: " +age);
}
}