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
What is the role of the architects in modern development​
pshichka [43]

Answer:

to plan, design, and oversee the construction of a building

7 0
3 years ago
Can i join three 12 volts batteriesto give me 24 volts output​
bulgar [2K]

Answer:

YES

Explanation:

If we connect batteries in series then the output voltage is the sum of the individual voltage of each battery i.e if you connect three 12 volts batteries in series then their output voltage will be 12+12+12=36 volts, but the current rating of the batteries in series will be same of the individual battery rating in 'mah'.

But when we connect the batteries in parallel their voltage is not added  but their current rating in mah is addition of their individual rating.

So, If you want 24 volts from three 12 volts battery then you can connect two of them in series and the other one in parallel with them this will give 24 volts and the current will be addition of the two series batteries and the third which is in parallel with them. You can use this configuration if current value is not a big factor.

8 0
3 years ago
Major processing methods for fiberglass composited include which of the following? Mark all that apply) a)- Open Mold b)- Closed
Novay_Z [31]

Answer:

it is f all of the above

Explanation:

let me know if im right

im not positive if im right but i should be right

4 0
3 years ago
In one study the critical stress intensity factor for human bone was calculated to be 4.05 MN/m3/2. If the value of Y in Eq. (2.
Diano4ka-milaya [45]
Where is Eq.(28) ?? You should show it to find the result
6 0
3 years ago
A liquid's viscosity increases with increasing temperature. a)-True b)-False
olasank [31]

Answer:

b) False

Explanation:

Viscosity:

   Viscosity is a fluid property and comes in the picture when fluid in the motion.In Simple words viscosity is the frictional force offered by fluid between the fluid layer.Viscosity provides a resistant to flow of fluid.

Generally viscosity are of two types

1.Dynamics viscosity

2.Kinematics viscosity

Generally in liquids when temperature of fluid is increases then molecular force between fluid particle goes to decreases.Due to this viscosity of liquids will decrease.

So our option b is right.

7 0
3 years ago
Other questions:
  • Most licensed architects are members of which association?
    13·2 answers
  • The type of current that flows from the electrode across the arc to the work is called what?
    5·1 answer
  • At a 4 percent annual growth rate in GDP per capita, it will take
    15·1 answer
  • A. Derive linear density expressions for BCC [110] and [111] directions in terms of the atomic radius R.
    7·1 answer
  • NASA’s Ames research center in Mountain View, California has a centrifuge built to simulate high-g environments. It spins horizo
    15·1 answer
  • (30 pts) A simply supported beam with a span L=20 ft and cross sectional dimensions: b=14 in; h=20 in; d=17.5 in. is reinforced
    13·1 answer
  • Tech A says that some relays are equipped with a suppression diode in parallel with the winding. Tech B says that some relays ar
    10·1 answer
  • Calculate the resistance of a circuit with 1.5 A and 120 V. Use the appropriate formula from the list of formulas on the
    9·1 answer
  • Work to be performed can come from the work package level of the work breakdown structure as well as other sources. Which of the
    11·1 answer
  • 9. A piece of Cherry wood is 5/4 x 4" X 4'<br> What is the length in inches?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!