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
m_a_m_a [10]
3 years ago
14

import java.io\.\*; import java.nio.file\.\*; public class TestFileReader { public static void main(String[] args) { Path p = Pa

ths.get("a.txt"); try (BufferedReader in = new BufferedReader( new FileReader(p.toFile()))) { String line = in.readLine(); while (line != null) { String[] v = line.split("::"); String lname = v[0]; String fname = v[1]; String dept = v[2]; System.out.println(fname + " " + lname + ", dept " + dept); line = in.readLine(); } } catch (FileNotFoundException e) { System.out.println("File not found."); } catch (IOException e) { System.out.println("I/O error."); } } } (Refer to code example 15-1.) What delimiter is used to separate fields in the a.txt file?
Computers and Technology
1 answer:
Charra [1.4K]3 years ago
6 0

Answer:

The delimiter use is "::".

Explanation:

The Java inbuilt String.split( ) function is use to split a String into an array of String.

The split( ) takes delimiter as arguments/parameter which determines at which point the string is to be broken down into different part/token.

From the above code snippet;

Each line in the file a.txt that is not null is splitted using the statement below:

String[ ] v = line.split("::");

The line is splitted using "::" as delimiter and the resulting array is then assigned to the variable 'v'.

For instance, a line in the file could take the form:

John::Smith::Music

When it is splitted,

String lname = John;

because lname make reference to index 0 of the array.

String fname = Smith;

because fname make reference to index 1 of the array.

String dept = Music;

and dept make reference to index 2 of the array.

You might be interested in
What are the MOST likely reasons that a student would research a topic using the internet?
Airida [17]

Answer:

To help with them with their work

5 0
3 years ago
Read 2 more answers
Which of the following is the result of a query?
IgorLugansk [536]
I think the answer is A
6 0
3 years ago
Which of the following statements about global variables is true? 1.A global variable is accessible only to the main function. 2
Korvikt [17]

Answer:

A global variable can have the same name as a variable that is declared locally within the function.

Explanation:

In computer program, we refer to a global variable as that variable that comes with a global perspective and scope, ensuring its visibility throughout the program, except it is shadowed. The set of this kind of variable is referred to as global state or global environment. One feature of global environment is that it can have similar name as a variable declared locally within the function.

7 0
3 years ago
Which team member on a project typically has a skill for creating visual interest?
bixtya [17]
I think designer i mean it should be
7 0
3 years ago
Read 2 more answers
Which of the following described a global network connecting billions of computers and other
zloy xaker [14]
Pretty sure its wifi
5 0
3 years ago
Read 2 more answers
Other questions:
  • You work for a large enterprise company that handles time-sensitive information. Your supervisor has asked that you set up a con
    8·1 answer
  • (Financial application: compound value) Suppose you save $100 each month into savings account with an annual interest rate of 5%
    6·1 answer
  • When sending a packet of data from source host to a destination host over a fixed route. Which of the delay components are varia
    8·1 answer
  • Luentifying message rullidl Upuuns
    12·1 answer
  • In Microsoft Excel, you have a large dataset that will print on several pages. You want to ensure that related records print on
    13·1 answer
  • A _______ is used to analyze and summarize your data without graphical support
    9·2 answers
  • We all had the unfortunate experience of seeing how computers can, at times, make life's journey about more difficult. This is e
    13·1 answer
  • An anchor tag can be coded using which two attributes? HELP ME PLEASE!!!!
    12·2 answers
  • Write a half page summary on how to clean a Gaming PC properly.
    14·1 answer
  • 1. Complete the following program so that it computes the maximum and minimum of the elements in the array. Write the program so
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!