Language:EN
Pages: 2
Words: 283
Rating : ⭐⭐⭐⭐⭐
Price: $10.99
Page 1 Preview
integerquestion lab exception handling detect inpu

Integerquestion lab exception handling detect input string

Ex: If the input is:

Lee 18

then the output is:

Lee 19

import java.util.Scanner;
import java.util.InputMismatchException;

public class NameAgeChecker {
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);

Solved Step By Step with Explanation : Exception handling to detect input String vs. Integer

public class NameAgeChecker {

public static void main(String[] args) {

while (!inputName.equals("-1")) {

try {

System.out.println(inputName + " 0");

}

You are viewing 1/3rd of the document.Purchase the document to get full access instantly

Immediately available after payment
Both online and downloadable
No strings attached
How It Works
Login account
Login Your Account
Place in cart
Add to Cart
send in the money
Make payment
Document download
Download File
img

Uploaded by : James Duncan

PageId: DOC2B71C8F