1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
-Dominant- [34]
3 years ago
11

The 'parseInt' method of the 'Integer' class throws a 'NumberFormatException' when it is passed a String argument that it cannot

convert to an int. Given the String variable s (which has already been assigned a value), write the code needed to convert the value in s assigning the result to the integer variable i If a NumberFormatException is thrown, i should be assigned the value -1.
Computers and Technology
1 answer:
vekshin13 years ago
3 0

Answer:

Following are the code in the java language  

try // try block

{

i = Integer.parseInt(s); // converting into the integer  

}  

catch (NumberFormatException e) // catch block

{

i = -1; // initialized i to -1.

}

Explanation:

Following is the description of code.

  • Create a try block in that clock we convert the variable "s" into the integer by using the function  Integer.parseInt and storing in the variable "i".
  • if try block gives an error the console is directly going  in the second we create a catch block for that try block In this block we initialized the variable  i to -1.
You might be interested in
Employees of ABC company uploaded files on a shared server with unique file naming conventions. However, they faced problems whi
sesenic [268]

WHAT ARE THE ANSWERS OMG WHY DO PEOPLE DO THIS

5 0
3 years ago
Read 2 more answers
When trying to solve a problem, Bret uses a logical, step-by-step formula called ________.
Alexxx [7]

Answer:

B) An Algorithm

Explanation:

An algorithm is defined as the step-by-step solution to a given problem that follows a logical sequence and which is also finite. In mathematics and computer science, the first step in solving a given problem is writing out the algorithm which will include steps for calculations, decisions, data processing, input/output etc. There are scientific ways of representing algorithms through the use of flowcharts, pseudocodes, data flow diagrams etc.

5 0
3 years ago
Your computer is taking longer than usual to open files and you noticed that your hard drive light stays on longer than usual wh
cestrela7 [59]

No don't do that. The best way to handle this is to back up all memory on your hard drive and get a bigger size hard drive. Preferably a 2 tb, If need more storage than that then buy a 500 GB ssd Samsung or other products and watch a video how to install one its easy. Its like a Lego. I built my gaming PC and i am 14 so i bet you can too.

4 0
3 years ago
What is authenticity​
jeka94

Answer:

the quality of being authentic

Explanation:

7 0
3 years ago
Top-level domain names are sometimes called _____.
Xelga [282]
Internet domain extention 
4 0
3 years ago
Other questions:
  • describe briefly one scenario where records stored in a computer frequently need to be searched. state why the searches may be c
    9·2 answers
  • What is a header and/or a footer? The bolded subtitle for each section or the footnote on any section Text inserted into the top
    11·1 answer
  • Count positive and negative number and compute the average. The program will have the user input an unspecified number of intege
    6·1 answer
  • Which is a color group in color theory?
    7·1 answer
  • Zahra's softball team needs money for team T-shirts. The coach makes some fundraising suggestions, while team members brainstorm
    5·2 answers
  • Use the drop-down menus to complete statements about back-up data files.
    12·2 answers
  • Computers were originally invented to
    12·2 answers
  • A bear is an animal and a zoo contains many animals, including bears. Three classes Animal, Bear, and Zoo are declared to repres
    12·1 answer
  • How can a user remove or delete a Pivot Table?
    8·1 answer
  • A user can add color to a database to highlight a modification. To do this with a macro, which command screen would you access o
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!