Question: 1. a. Consider the following line segment of a Java program. What does it mean using throws keyword in the line? static void amount(int
1. a. Consider the following line segment of a Java program. What does it mean using throws keyword in the line? static void amount(int a) throws ArithmeticException { } b. What is the output of the following Java code? Explain. class Rahim implements Runnable { int a, b; public void run() { for(int p= 0; p < 500; p++) synchronized (this) (a = 20; b = 20; System.out.println(a); System.out.println(b); public static void main(String args[]) { Rahim run new Rahim (); Thread J1 Thread j2 j1.start(); j2.start(); new Thread(run); new Thread(run); } c. Write a Java program to find the area and perimeter of rectangle square and triangle using interface and method overloading?
Step by Step Solution
3.42 Rating (155 Votes )
There are 3 Steps involved in it
a In the given Java program line static void amountint a throws ArithmeticException The throws keyword is used to declare that the amount method may throw an ArithmeticException This is a way of indic... View full answer
Get step-by-step solutions from verified subject matter experts
