This topic contains a solution. Click here to go to the answer

Author Question: Suppose you enter 34.3 57.8 789, then press the ENTER key. Analyze the following code.Scanner input ... (Read 210 times)

pragya sharda

  • Hero Member
  • *****
  • Posts: 566

Question 1

Which method can be used to create an input object for file temp.txt?
◦ new Scanner("temp.txt")
◦ new Scanner(File("temp.txt"))
◦ new Scanner(new File("temp.txt"))
◦ new Scanner(temp.txt)

Question 2

Suppose you enter 34.3 57.8 789, then press the ENTER key. Analyze the following code.

Scanner input = new Scanner(System.in);
int v1 = input.nextInt();
int v2 = input.nextInt();
String line = input.nextLine();

◦ After the last statement is executed, line contains characters '7', '8', '9', '\n'.
◦ The program has a runtime error because 34.3 is not an integer.
◦ After the last statement is executed, v1 is 34.
◦ After the last statement is executed, line contains characters '7', '8', '9'.


Related Topics

Need homework help now?

Ask unlimited questions for free

Ask a Question
Marked as best answer by pragya sharda on May 6, 2020

AngeliqueG

  • Sr. Member
  • ****
  • Posts: 343
Lorsum iprem. Lorsus sur ipci. Lorsem sur iprem. Lorsum sur ipdi, lorsem sur ipci. Lorsum sur iprium, valum sur ipci et, vala sur ipci. Lorsem sur ipci, lorsa sur iprem. Valus sur ipdi. Lorsus sur iprium nunc, valem sur iprium. Valem sur ipdi. Lorsa sur iprium. Lorsum sur iprium. Valem sur ipdi. Vala sur ipdi nunc, valem sur ipdi, valum sur ipdi, lorsem sur ipdi, vala sur ipdi. Valem sur iprem nunc, lorsa sur iprium. Valum sur ipdi et, lorsus sur ipci. Valem sur iprem. Valem sur ipci. Lorsa sur iprium. Lorsem sur ipci, valus sur iprem. Lorsem sur iprem nunc, valus sur iprium.
Answer Preview
Only 50% of students answer this correctly




pragya sharda

  • Member
  • Posts: 566
Reply 2 on: May 6, 2020
Gracias!


AngeliqueG

  • Member
  • Posts: 343
Reply 3 on: Yesterday
:D TYSM

 

Did you know?

There are more sensory neurons in the tongue than in any other part of the body.

Did you know?

Drug-induced pharmacodynamic effects manifested in older adults include drug-induced renal toxicity, which can be a major factor when these adults are experiencing other kidney problems.

Did you know?

According to the American College of Allergy, Asthma & Immunology, more than 50 million Americans have some kind of food allergy. Food allergies affect between 4 and 6% of children, and 4% of adults, according to the CDC. The most common food allergies include shellfish, peanuts, walnuts, fish, eggs, milk, and soy.

Did you know?

Pubic lice (crabs) are usually spread through sexual contact. You cannot catch them by using a public toilet.

Did you know?

Though Candida and Aspergillus species are the most common fungal pathogens causing invasive fungal disease in the immunocompromised, infections due to previously uncommon hyaline and dematiaceous filamentous fungi are occurring more often today. Rare fungal infections, once accurately diagnosed, may require surgical debridement, immunotherapy, and newer antifungals used singly or in combination with older antifungals, on a case-by-case basis.

For a complete list of videos, visit our video library