-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3e5dbc8
commit cf23338
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import java.io.BufferedReader; | ||
import java.io.BufferedWriter; | ||
import java.io.FileInputStream; | ||
import java.io.FileOutputStream; | ||
import java.io.FileReader; | ||
import java.io.FileWriter; | ||
import java.io.InputStreamReader; | ||
import java.io.IOException; | ||
class input{ | ||
void scan() throws IOException { | ||
try { | ||
FileOutputStream fr=new FileOutputStream("hello.txt"); | ||
BufferedReader bf=new BufferedReader(new InputStreamReader(System.in)); | ||
System.out.println("Enter a line of text"); | ||
String line=bf.readLine(); | ||
fr.write(line.getBytes()); | ||
fr.close(); | ||
} | ||
catch(IOException e) { | ||
e.printStackTrace(); } | ||
} | ||
} | ||
class output{ | ||
void print() throws IOException { | ||
try { | ||
BufferedReader bff=new BufferedReader(new FileReader("hello.txt")); | ||
FileReader fr1=new FileReader("hello.txt"); | ||
String contents; | ||
while((contents=bff.readLine())!=null) { | ||
System.out.println(contents); | ||
} | ||
}catch(IOException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
} | ||
public class nands { | ||
|
||
public static void main(String[] args) throws IOException{ | ||
input in=new input(); | ||
in.scan(); | ||
output ou=new output(); | ||
ou.print(); | ||
|
||
} | ||
|
||
} |