Examlex
import java.util.*;
public class DivisionMistakeCaught3
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
int numerator, denominator, result;
try
{
System.out.print("Enter numerator >> ");
numerator = input.nextInt();
System.out.print("Enter denominator >> ");
denominator = input.nextInt();
result = numerator / denominator;
System.out.println(numerator + " / " + denominator + " = " + result);
}
catch(ArithmeticException mistake)
{
System.out.println(mistake.getMessage());
}
catch(InputMismatchException mistake)
{
System.out.println("Wrong data type");
}
}
}
Using the above code, describe what will happen if a user enters two usable integers. What will happen if a user enters an invalid noninteger value? What will happen if the user enters 0 for the denominator?
Codes of Behaviour
Established rules or standards governing the actions or conduct of individuals within a group or society.
Internal Social Control
Regulates people through socialization and shapes people’s minds so they come to regard deviant actions as undesirable.
Importance of Learning
The significance attached to acquiring knowledge and skills, emphasizing its role in personal development, career advancement, and societal progress.
Grounding
In a psychological context, it refers to techniques used to bring someone fully into the present and calm the mind, often used in managing anxiety or stress.
Q18: Providing values for all the elements in
Q20: int[][] myVals = {{2, 4, 6}, {1,
Q21: The _ comparison operator is used to
Q21: Describe how a loop is controlled by
Q39: What is a finally block and how
Q53: What are the four JFrame constructors?
Q53: import java.util.*; <br>public class sortArray <br>{ <br>
Q55: To generate the most readable format for
Q57: What is the difference between volatile and
Q75: When you assign a variable or constant