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
When is a handrail required for stairs?
Leviafan [203]

Answer:

after 8 stepshddnffuddbnggkbdbkloyr

5 0
3 years ago
The process _______ boosted the production of fertilizers and strengthened the agriculture industry.
ANTONII [103]

Answer:

Process of Green Revolution

Explanation:

Green Revolution is a process which started its initiatives between the 1950s and 1960s, a technological research process, that increase agricultural productions through various systematic approach, which are different from the traditional methods. These technological approach includes:

1.  Utilization of new varieties with a high yield potential, in addition with adequate water  supply, pesticides and fertilizers.

2.  New methods of cultivation and mechanization

Hence, the process of Green Revolution boosted production of fertilizers and strengthen the agriculture industry as a whole.

6 0
3 years ago
I = 48 mA, R = 1125 2. What is Vs ?
german
54 volts

Ohms law. E= I x R
6 0
4 years ago
Who developed the process of blueprinting?
VikaD [51]
Answer: C.) John Herschel
3 0
3 years ago
Show the ERD with relational notation with crowfoot. Your ERD must show PK, FKs, min and max cardinality, and correct line types
zhenek [66]

Answer

The answer and procedures of the exercise are attached in the following archives.

Step-by-step explanation:

You will find the procedures, formulas or necessary explanations in the archive attached below. If you have any question ask and I will aclare your doubts kindly.  

3 0
4 years ago
Other questions:
  • A evolução da malha rodoviária do Brasil é um marco notável
    9·1 answer
  • 3) What kind of bridges direct their load along it's curve and into the
    12·1 answer
  • I am standing on the upper deck of the football stadium. I have an egg in my hand. I am going to drop it and you are going to tr
    7·1 answer
  • A very large plate is placed equidistant between two vertical walls. The 10-mm spacing between the plate and each wall is filled
    11·1 answer
  • A PMMA plate with a 25 mm (width) x 6.5 mm (thickness) cross-section has a contained crack of length 2c = 0.5 mm in the center o
    10·1 answer
  • A 75- kw, 3-, Y- connected, 50-Hz 440- V cylindrical synchronous motor operates at rated condition with 0.8 p.f leading. the mot
    6·1 answer
  • Can you guys please introduce yourself​
    15·2 answers
  • A horse pulls a cart along a road with a force of 550 lbs. If the horse does 2,674,100 ftlbs of work by the time it stops, how f
    9·2 answers
  • Why is engineering profession important ​
    11·1 answer
  • Flip-flops are normally used for all of the following applications, except ________. logic gates data storage frequency division
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!