I would like to know the difference between .add() method and the .offer() method. Thanks!!
Although they are very similar they aren't the same. There is a difference in the interfaces that are used within the methods, but the most substantial difference to you would be that if the add method can not add the item to the list an error will be thrown, whereas the offer method would not. The non-positional add method and the addLast method are however, the same.
Problem Statement Given two integers a and b, your task is to calculate and print the following four values:
Please help, any idea?