...

/

Solution Review: Compute the Sum

Solution Review: Compute the Sum

The solution to the exercise covered in the previous lesson is explained in this lesson.

We'll cover the following...

Solution review

Let’s take a look at the solution first.

Press + to interact
public class PrimitiveDataTypes {
public static void main(String[] args){
final byte numOne = 104;
final byte numTwo = 110;
int sumOfTwoNumbers;
sumOfTwoNumbers = numOne + numTwo;
//sumOfTwoNumbers = (byte)(numOne + numTwo);
System.out.println("Sum: " + sumOfTwoNumbers);
}
}

Explanation

We have ...