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]
3 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]3 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
Tools for forming aluminum tray
alina1380 [7]

Answer:

Sheet metal forming dates back to the days of the blacksmith who used a hammer and hot oven to mold metal into the desired form. Today’s aircraft technician relies on a wide variety of powered and hand-operated tools to precisely bend and fold sheet metal to achieve the perfect shape. Forming tools include straight line machines, such as the bar folder and press brake, as well as rotary machines, such as the slip roll former. Forming sheet metal requires a variety of tools and equipment (both powered and manual), such as the piccolo former, shrinking and stretching tools, form blocks, and specialized hammers and mallets. [Figure 4-55]

3 0
3 years ago
The blade tension is correct when you can hear a<br>O Thunk<br>O Twang<br>O Neither​
Anastaziya [24]

Answer:

maybe it's twang because of the blade tension

3 0
3 years ago
These waveforms are applied to a gated D latch, which is initially RESET. Which of the areas identified on the Q waveform is inc
Andrej [43]

Question Completion with Options:

A) Area a B) Area b C) Area c D) Area d

Answer:

The incorrect waveform identified on the Q waveform is the:

C) Area c.

Explanation:

Area c is the incorrect waveform because its output is not correct.  The Q waveform indicates that the electrical forces project toward the negative pole of the lead axis.  A gated D latch is a flip flop latch with an additional control input, which determines when to change the state of the circuit. Most times, this control unit is a clock input or an enable input.

8 0
3 years ago
A 2-m-long and 3-m-wide horizontal rectangular plate is submerged in water. The distance of the top surface from the free surfac
UkoKoshka [18]

Answer:

864 KN

Explanation:

Atmospheric pressure is defined as the force per unit area exerted against a surface by the weight of the air above that surface.

Please kindly check attachment for the step by step solution of the given problem.

3 0
3 years ago
An 80-L vessel contains 4 kg of refrigerant-134a at a pressure of 160kPa. Determine (a) the temperature, (b) the quality, (c) th
makvit [3.9K]

Answer:

temperature -15.6 C, quality x=0.646, enthalpy h=667.20 KJ, volume of vapor phase Vg= 79.8 L

Explanation:

property table for R-134a

https://www.ohio.edu/mechanical/thermo/property_tables/R134a/R134a_PresSat.html

at 160 KPa , temperature = -15.66 C

quality x=mass of vapour/ total mass of liq-vap mixture

alternaternately: x=(v-vf)/(vg-vf)    

v=total volume i.e. volume of container"80L"   80L=0.08 cubic meter

vf=vol of liquid phase  vg=vol of vapor phase vf, vg values at 160Kpa

x=(0.08-0.0007437)/(0.1235-0.0007437)=0.646

enthalpy

h=hf+xhfg          hf, hfg values at 160Kpa

h=hf+xhfg=31.2+0.646(209.9)=166.80 KJ/Kg

for 4Kg R-134a h=m(166.80 KJ/Kg )=667.20 KJ

volume of vapor phase

vg at 160Kpa=0.1235 cubic meter for quality=1.

in this case quality=0.646 , so it will occupy 64.6% space of the vapor phase at quality=1.

vol. of vapor phase=0.646*0.1235=0.0798 cubic meter=79.8 L

7 0
3 years ago
Other questions:
  • A evolução da malha rodoviária do Brasil é um marco notável
    9·1 answer
  • Light energy produces the only voltage in a solar cell. (a)-True(T) (b)- false(F)
    9·1 answer
  • Teresa is a civil engineer who uses her automobile for business. Teresa drove her automobile a total of 11,965 miles during 2019
    11·1 answer
  • std::string x[n]; int mode1count = 0; // msft int mode2count = 0; // appl int mode3count = 0; // csco int mode4count = 0; // imb
    13·1 answer
  • Nitrogen enters a steady-flow heat exchanger at 150 kPa, 10°C, and 100 m/s, and it receives heat as it flows through it. Nitroge
    15·1 answer
  • Realize the function f(a, b, c, d, e) = Σ m(6, 7, 9, 11, 12, 13, 16, 17, 18, 20, 21, 23, 25, 28)using a 16-to-1 MUX with control
    13·1 answer
  • A. Calculate the concentration of a toxic (Cout) that is added to a lake with an input concentration of 100 μg/l. The flow rate
    10·1 answer
  • What happens to the amperage draw of a condensing unit on a split AC system if the liquid line is restricted
    15·1 answer
  • COMO ES LA MADERA CUANDO LA TIERRA ES HUMEDA
    7·2 answers
  • List six possible valve defects that should be included in the inspection of a used valve?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!