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
xeze [42]
4 years ago
3

There are two text files, whose names are given by two String variables, file1 and file2. These text files have the same number

of lines. Write a sequence of statements that creates a new file whose name consists concatenating the names of the two text files (with a "-" in the middle) and whose contents of merging the lines of the two files. Thus, in the new file, the first line is the first line from the first file, the second line is the first line from the second file. The third line in the new file is the second line in the first file and the fourth line is the second line from the second file, and so on. When finished, make sure that the data written to the new file has been flushed from its buffer and that any system resources used during the course of running your code have been released.
Computers and Technology
1 answer:
PIT_PIT [208]4 years ago
8 0

Answer:

The code to this question can be given as:

Code:  

//creating a file class object.

File f1 = new File();

f1.File(file1);  //call parameterized constructor .

File f2 = new File();

f2.File(file2);  //call parameterized constructor .

//creating Scanner class object for user input and pass parameter

Scanner ob1 = new Scanner(f1);

Scanner ob2 = new Scanner(f2);

//create String variable  File3 that holds the value of file1 and file2

String File3 = file1 + "-" + file2;  

//create File class object and pass parameter File3.

File files = new File(File3);

//creating PrintWriter class object.

PrintWriter ob = new PrintWriter();

ob. PrintWriter(file3);  //call parameterized constructor .

while(ob1.hasNextLine())  //loop

{

//print value.

System.out.println(ob1.nextLine());  

System.out.println(ob2.nextLine());

}

output.close();

output.close();

Explanation:

In the above java code firstly we create the File class object.Then we call the parameterized constructor of this class. Then we create the scanner class object. In the input time, we pass the parameter to scanner class object and we declare the String variable that is File3. In this variable, we add both file1 and file2 value with concatenating "-". Then we create the PrintWriter class object and call their constructor. At the last, we declare the loop that prints all the values.

You might be interested in
Describe how spacecraft evolved from the US Mercury to contemporary space shuttles.
pashok25 [27]

Answer:

Several of the subsystems evolved during the program through design changes: The parachute system, essential for booster recovery, was redesigned with larger parachutes in 1983. Frangible nuts, used in the space shuttle pad hold down and release system, were redesigned in 2008.

8 0
3 years ago
when using screwdrivers you should always be aware that the screwdriver blade might slip out of the slot and strike you in the .
ELEN [110]

When using screwdrivers you should always be aware that the screwdriver blade might slip out of the slot and strike you in the:

  • -hand
  • -eye
  • -mouth

<h3>What is a Screwdriver?</h3>

A screwdriver is said to be a kind of a modern tool that can come in a manual or powered type and it is one that is often used for turning screws.

Note that a typical simple screwdriver is one that has a handle as well as a shaft and it is also one that is often ending in a tip where a given user can be able to put their hands into the screw head before turning the handle.

Therefore, when using screwdrivers you should always be aware that the screwdriver blade might slip out of the slot and strike you in the:

  • -hand
  • -eye
  • -mouth

Learn more about screwdrivers  from

brainly.com/question/20717091

#SPJ4

3 0
1 year ago
A chart that shows the resource (project team member) along with their allocated hours for each week is known as a(n):
Anon25 [30]

Answer: b) GNATT chart

Explanation: GNATT is the type of chart that displays the schedule or working in the form of bars in horizontal direction .The chart displays the duties /task performed on the vertical axis and the time periods on horizontal axis week-vise. This chart is usually used for project management purpose fr coordination, tracing, planning etc.

Other options are incorrect because project staffing chart is for the display of the staff activities involved during project, histogram is graph representation using bars of different heights and entity diagram displays the entities relation in databases..Thus , the correct option is option(b).

4 0
3 years ago
List the steps to look it install and then run a program or mobile app
Luda [366]

Answer:

1. Open a cloud installer (the source), which is usually Play Store, Aptoide, or UpToDown, in the case of Android phones.

2. Request the package from the server, which will be transmitted via an internet connection. Usually called "downloading".

3. Allow the package provider (mobile store) to install the app on the system, this being the "install" part, where it's put together.

4. Run the app by, usually, pressing the icon in the app drawer.

3 0
3 years ago
Which of the following is NOT a characteristic developed by New Journalism?
krok68 [10]
Flashy page layouts
7 0
3 years ago
Other questions:
  • A __________ is the column of data in a database that is used as the basis for arranging data.
    8·2 answers
  • The software used to help run the computer hardware is the _____.
    15·2 answers
  • Which principle of animation deals with imparting a unique identity to the animated character?
    5·1 answer
  • Would these statements cause an error? Why or why not? int year = 2019; int yearNext = 2020; int &amp; ref = year; &amp; ref = y
    7·1 answer
  • A small, electronic chip that a manufacturer develops for use in another product (such as a digital camera or microwave oven) is
    11·2 answers
  • (a) Store last 7 digits of your student ID in a vector (7 element row or column vector). Write a MATLAB code which creates a 7x7
    11·1 answer
  • A.
    14·1 answer
  • 13. By adding built-in writable memory to its cartridge, Nintendo’s _________________ was the first console game that gamers cou
    9·1 answer
  • A for construct is a loop construct that processes a specified list of objects. As a result, it is executed as long as there are
    12·1 answer
  • which tool in administrative tools should you open if you want to view messages to troubleshoot errors? a. resource monitor b. e
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!