




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





























































































import j a v a. i o. F i l e ;
public class JavaLS {
public s t a t i c void main ( S t r i n g [ ] args ) { F i l e pwd = new F i l e ( ". " ) ; S t r i n g [ ] l i s t = pwd. l i s t ( ) ; f o r ( i n t i = 0 ; i < l i s t. l e n g t h ; i ++ ) { System. o u t. p r i n t l n ( l i s t [ i ] ) ; } } }
import j a v a. i o. F i l e I n p u t S t r e a m ; import j a v a. i o. F i l e O u t p u t S t r e a m ; import j a v a. i o. IOException ;
public class CopyBytes { public s t a t i c void main ( S t r i n g [ ] args ) throws IOException { F i l e I n p u t S t r e a m i n = n u l l ; F i l e O u t p u t S t r e a m ou t = n u l l ; t r y { i n = new F i l e I n p u t S t r e a m ( " i n f i l e. t x t " ) ; o ut = new F i l e O u t p u t S t r e a m ( " o u t f i l e. t x t " ) ; i n t c ;
while ( ( c = i n. read ( ) )! = −1) { o ut. w r i t e ( c ) ; }
} f i n a l l y { i f ( i n! = n u l l ) { i n. c l o s e ( ) ; } i f ( o ut! = n u l l ) { o ut. c l o s e ( ) ; } } } }