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
garik1379 [7]
2 years ago
5

Define a public static method named s2f that takes two String arguments, the name of a file and some text. The method creates th

e file and writes the text to it. If all goes well the method returns true. If, however, either of its arguments are null or if there is any problem in creating or writing to the file, the method returns false.
Engineering
1 answer:
marin [14]2 years ago
7 0

Answer:

import java.io.IOException;

import java.io.PrintWriter;

/*

* To change this license header, choose License Headers in Project Properties.

* To change this template file, choose Tools | Templates

* and open the template in the editor.

*/

public class WriteFile {

public static boolean s2f(String fileName,String content)

{

boolean result = true;

if(content == null || fileName == null)

result = false;

else

{

try{

PrintWriter fileWriter = new PrintWriter(fileName, "UTF-8");

fileWriter.println(content);

fileWriter.close();

} catch (IOException e) {

result = false;

}

}

return result;

}

public static void main(String[] args)

{

boolean res = s2f("data.txt","Java is awesome.");

if(res==true)

System.out.println("Successful");

else

System.out.println("There was some error in writing to a file.");

}

}

You might be interested in
Input signal to a controller is​
alexgriva [62]

Answer:

were the cord plugs in

Explanation:

4 0
3 years ago
The enforcement of OSHA standards is provided by federal and state
Gnoma [55]

Answer:

Explanation:

Enforcing OSHA, Occupational Safety and Health Administration, standards is not a job for electricians, lawmakers or tax collectors. The right answer is safety inspectors.

3 0
1 year ago
The term variation describes the degree to which an object or idea differs from others of the same type or from a standard.
AfilCa [17]
The answer is true. Thank me later<3
5 0
2 years ago
Read 2 more answers
Three groups of students are given study outlines for 6 weeks. One group studies 2 hours a night, a second group studies 1 hour
katrin2010 [14]

Answer:

The constant here is the study outline

Explanation:

In scientific research, the constant variable is that part/variable of the experiment that does not change or is set not to change. Examples include temperature, environment or height.

Assuming the scenery described in this question is an experiment. All the groups presented are bound by a constant during the experiment. The constant here is the study outline. The study outline provided to the students is not going to change.

NOTE: There could be confusion as regards the answer being the final exam grade but that will be the dependent variable as that will be the outcome of the experiment while the time spent to study will be the independent variable.

8 0
2 years ago
As project manager, you approve a team member’s request to change the order of their tasks because they think it will be more ef
Oduvanchick [21]

The project is going to scope if the situation happens. Option A is correct.

<h3 /><h3>What is the function of a project manager?</h3>

Project managers are in charge of organizing, planning, and guiding the execution of certain projects for an organization .

As the project manager, you grant a team member's request to rearrange their work in a way they believe will increase productivity.

However, this modification interferes with another team member's workflow since they now have to complete two more activities that are unrelated to the project's objective. The project will be within its scope.

Hence option A is correct.

To learn more about the project manager refer;

brainly.com/question/15404120

#SPJ1

6 0
2 years ago
Other questions:
  • An aluminum heat sink (k = 240 W/m-K) used to cool an array of electronic chips consists of a square channel of inner width w =
    6·2 answers
  • Oil with a density of 800 kg/m3 is pumped from a pressure of 0.6 bar to a pressure of 1.4 bar, and the outlet is 3 m above the i
    9·1 answer
  • A power company desires to use groundwater from a hot spring to power a heat engine. If the groundwater is at 95 deg C and the a
    7·1 answer
  • For a steel alloy it has been determined that a carburizing heat treatment of 11-h duration will raise the carbon concentration
    12·1 answer
  • What type of fuel does a 2 cycle engine use
    5·1 answer
  • The thermal energy is carried by electromagnetic waves
    12·1 answer
  • What are the main causes of injuries when using forklifts?
    5·1 answer
  • 6
    10·2 answers
  • Find the remaining trigonometric function of 0 if
    13·1 answer
  • How many times greater is the value of the 2 of the 270413 than the valuce of the 2 in 419427?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!