Question: how to calculate perimeter of a rectangle in java?
Answer: Input length and width of rectangle from user. ... 
Apply formula to calculate rectangle perimeter i.e. perimeter = 2 * (length + width) .
Apply formula to calculate rectangle area i.e. area = length * width .
Finally, print the value of perimeter and area .