i'm trying to accept Integer value as string using getLine. I'm converting that string to integer us

Aug 15th, 2016
Studypool Tutor
ASA Institute of Business and Computer Technology
Price: $10 USD

Tutor description

i'm trying to accept Integer value as string using getLine. I'm converting that string to integer using this code. catch (print(read str :: Int)) handler problem is when user input any other type of values. I want the message "ERR" to be shown and exit program, when wrong data type is input from user. Please help me asap

Word Count: 1164
Showing Page: 1/3
Answer--------------------Converting String to integer and Integer to String is one of the basic tasks of Java and mostpeople learned about it when they learn Java programming. Even though String tointeger and Integer to String conversion is basic stuff but same time its most useful alsobecause of its frequent need given that String and Integer are two most widely used type in allsort of program and you often gets data between any of these format. One of the commontask of programming is converting one data type another e.g. Converting Enum toString or Converting Double to String, Which are similar to converting String to Integer.Some programmer asked question that why not Autoboxing can be used toConvert String to int primitive or Integer Object? Remember autoboxing only convertsprimitive to Object it doesn't convert one data type to other. Few days back I had to convert abinar

Review from student

Studypool Student
" awesome work thanks "
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1828 tutors are online

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors