-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.java
35 lines (30 loc) · 1.05 KB
/
main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
public class main {
public static void main(String[] args) throws FileNotFoundException, IOException {
String txt="mustafaa abshir xoodiyee";
Convert toOsmanya= new Convert(txt);
String convertedText= toOsmanya.stringToChars();
writeUsingFileWriter(convertedText);
System.out.println("Your text is converted to " + convertedText);
}
private static void writeUsingFileWriter(String convertedText) {
File file = new File("C:/Users/User/Desktop/Java/OsmanyaConvertor/output.txt");
FileWriter fr = null;
try {
fr = new FileWriter(file, false);
fr.write(convertedText);
} catch (IOException e) {
e.printStackTrace();
}finally{
//close resources
try {
fr.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}