java declare integer code example Example 1: how do you set an integer to a number in java int num = 9; Example 2: declare int java int number = 10;