Absolute Java (6th Edition)
Absolute Java (6th Edition)
6th Edition
ISBN: 9780134041674
Author: Walter Savitch, Kenrick Mock
Publisher: PEARSON
bartleby

Concept explainers

bartleby

Videos

Textbook Question
Book Icon
Chapter 2, Problem 19STE

What is missing from the following code, which attempts to open a file and read an integer?

import java .util .Scanner; import java .io .FilelnputStream; import java .io .FileNotFoundException; public class Readlnteger {         public static void main(String [] args)        {                Scanner Eilein = new Scanner(                    new FilelnputStream("datafile .txt"));                int num = fileln .nextint();                System .out .println(num);        } }

Blurred answer
Students have asked these similar questions
import java.util.Scanner;import java.io.File;import java.io.IOException;public class test2{public static void main(String [] args)throws IOException{File database = new File ("flights.txt");Scanner fileReader = new Scanner( database );Scanner input = new Scanner(System.in);// Displays the welcome screenint menuCheck = 0;String city = "";float oneWayCost = 0f;float roundTripCost = 0f;int numberOfSeats = 0;float total = 0f;while (menuCheck == 0){System.out.println("Welcome TO MEjia AIRLINES.");System.out.println("Please select a choice below [1-5]");System.out.println(" 1. Add flight");System.out.println(" 2. View trip");System.out.println(" 3. Manage Trip");System.out.println(" 4. Checkout");System.out.println(" 5. Exit Mejia airlines");int userInput = input.nextInt();if (userInput == 5){System.out.println("Thank You for using Mejia airlines");System.out.println("Stay safe! Stay Hrydrated! Happy Coding!");menuCheck = -5;}else if (userInput == 1){menuCheck = 1;}else if (userInput ==…
StringFun.java import java.util.Scanner; // Needed for the Scanner class 2 3 /** Add a class comment and @tags 4 5 */ 6 7 public class StringFun { /** * @param args not used 8 9 10 11 12 public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Please enter your first name: "); 13 14 15 16 17 18 System.out.print("Please enter your last name: "); 19 20 21 //Output the welcome message with name 22 23 24 //Output the length of the name 25 26 27 //Output the username 28 29 30 //Output the initials 31 32 33 //Find and output the first name with switched characters 34 //All Done! } } 35 36 37
// Program describes two files // tells you which one is newer and which one is larger import java.nio.file.*; import java.nio.file.attribute.*; import java.io.IOException; public class DebugThirteen1 {    public static void main(String[] args)    {       Path file1 =          Paths.get("/root/sandbox/DebugDataOne1");       Path file2 =          Paths.get("/root/sandbox/DebugDataOne2.txt");       try       {          BasicFileAttributes attr1 =             Files.readAttributes(file1, BasicFileAttributes.class);          System.out.println("File: " + file1getFileName());          System.out.println("Creation time " + attr1.creationTime());          System.out.println("Last modified time " + attr1lastModifiedTime());          System.out.println("Size " + attr1.size());          BasicFileAttributes attr2 =             Files.readAttributes(file2, BasicFileAttributes.class);          System.out.println("\nFile: " + file2.getFileName);          System.out.println("Creation time " +…

Chapter 2 Solutions

Absolute Java (6th Edition)

Additional Engineering Textbook Solutions

Find more solutions based on key concepts
Fat Gram Calculator Write a program that asks the user to enter the number of calories and fat grams in a food ...

Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)

Why were computer programming languages invented?

Starting Out With Visual Basic (8th Edition)

Heads or TaiLs Game This game is meant for two or more players. In this game, the players take turns flipping a...

Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)

Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Constants, Variables, Data types, Keywords in C Programming Language Tutorial; Author: LearningLad;https://www.youtube.com/watch?v=d7tdL-ZEWdE;License: Standard YouTube License, CC-BY