|
|
@ -6,13 +6,13 @@ public class HolaFichero { |
|
|
|
|
|
|
|
static char Sistema; |
|
|
|
|
|
|
|
public static void main(String args[]) { |
|
|
|
public static void main(String args[]) throws IOException { |
|
|
|
char Sistema=MiSistema(); |
|
|
|
System.out.println(Sistema); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
static char MiSistema() { |
|
|
|
static char MiSistema() throws IOException { |
|
|
|
char Sis='?'; |
|
|
|
char Windows='W'; |
|
|
|
char Linux='L'; |
|
|
@ -22,6 +22,7 @@ public class HolaFichero { |
|
|
|
if (so.charAt(0)==Windows) { |
|
|
|
System.out.print("Windows -> "); |
|
|
|
Sis=Windows; |
|
|
|
CreoFicheroWindows(); |
|
|
|
} |
|
|
|
else { |
|
|
|
System.out.print("Linux -> "); |
|
|
@ -30,9 +31,9 @@ public class HolaFichero { |
|
|
|
return Sis; |
|
|
|
} |
|
|
|
|
|
|
|
public void CreoFicheroWindows() throws IOException { |
|
|
|
public static void CreoFicheroWindows() throws IOException { |
|
|
|
System.out.println("Creando fichero en Windows ..."); |
|
|
|
File fwindows = new File("G:\\ADA\\T1.Ficheros\\CreoFicheroWindows.txt"); |
|
|
|
File fwindows = new File("C:\\Users\\kevin\\Documents\\CreoFicheroWindows.txt"); |
|
|
|
if (!fwindows.exists()) { |
|
|
|
fwindows.createNewFile(); |
|
|
|
} |
|
|
|