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
Steam undergoes an isentropic compression in an insulated piston–cylinder assembly from an initial state where T1 5 1208C, p1 5
balu736 [363]

Answer:

temperature T2 = 826.9°C

\frac{W}{m} = -1142.7 kJ/kg

Explanation:

given data

initial state temperature = 120°C

final state pressure p1 = 1 bar

pressure p2 =  100 bar

solution

we use here super heated water table A6 that is

specific internal energy u1 = 2537.3 kJ/kg

specific entropy s1 = 7.4668 kJ/kg.K

and

here specific entropy stage 1 = stage 2

so for specific entropy and pressure 100 bar

specific internal energy u2 = 3680 kJ/kg

and temperature T2 = 826.9°C

so here now we get specific work of steam is

ΔU = -W     ...........1

m ( u1 - u2) = W

\frac{W}{m} = u1 - u2

\frac{W}{m} = 2537.3 - 3680

\frac{W}{m} = -1142.7 kJ/kg

3 0
3 years ago
In a long trip what is considered a life line to take with you.
Sophie [7]

Answer:

An emergency kit

Explanation:

The reason I say this is because:

A first aid kit can aid you if you have..

Scars

Cuts

Bruises

So, i would say that The first aid kit is the life line.

5 0
2 years ago
Gshyevdnmdcicm gngjc
Len [333]

This is not a valid question. Please try again.

4 0
3 years ago
You’ve experienced convection cooling if you’ve ever extended your hand out the window of a moving vehicle or into a flowing wat
Anna35 [415]

Answer:

Condition A

Heat flux is 1400 W/M^2

Condition B

Heat flux is 12800 w/m^2

Explanation:

Given that:

T_s is given as  30 degree celcius

condition A

Air temperature =  - 5 degree c

convection coefficient h = 40 w/m^2. k

heat\ flux = \frac{Q}{a}= h\Delta = 40{30 - (-5)} = 1400 w/m^2

condition A

water temperature  = 10 degree c

convection coefficient = 800 w/m^2.k

heat\ flux = \frac{Q}{A} = H(\Delta} = 800\times (30-14) = 12800w/m^2

7 0
3 years ago
An operating gear box (transmission) has 350 hp at its input shaft while 250. hp are delivered to the output shaft. The gear box
True [87]

Answer:

Rate of Entropy =210.14 J/K-s

Explanation:

given data:

power delivered to input = 350 hp

power delivered to output = 250 hp

temperature of surface = 180°F

rate of entropy is given as

Rate\  of\ entropy  = \frac{Rate\ of \ heat\  released}{Temperature}

T = 180°F = 82°C = 355 K

Rate of heat = (350 - 250) hp = 100 hp = 74600 W

Rate of Entropy= \frac{74600}{355} = 210.14 J/K-s

8 0
3 years ago
Other questions:
  • Suppose an underground storage tank has been leaking for many years, contaminating a groundwater and causing a contaminant conce
    8·1 answer
  • As an employee, who's is supposed to provide training on the chemicals you are handling or come in contact with at work?
    14·2 answers
  • What must you do if hauling a load of material which could fall or blow onto the roadway?
    14·1 answer
  • What is the temperature dependency of the electrical conductivity for metals and semiconductors??
    6·1 answer
  • What is Euler's equation?
    6·1 answer
  • When does someone's work on the Internet become copyrighted?
    15·1 answer
  • An op-amp differential amplifier is built using four identical resistors, each having a tolerance of ±5%. Calculate the worst p
    14·1 answer
  • 7–2 Cooling of a Hot Block by Forced Air at High
    6·1 answer
  • QUICK ASAP!!!
    6·1 answer
  • assuming complementary inputs are available, the minimum number of transistors needed to realize a two input xor gate is:
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!