commit 97326a70ef2af4d5035e88e46928e5f13ff49aec Author: Ivan Morell Date: Mon Sep 19 17:25:25 2022 +0200 Test Fichero diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..57bca72 --- /dev/null +++ b/.classpath @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..09cf73a --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + HolaFichero + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..8c9943d --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,14 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=17 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=17 diff --git a/bin/Package/HolaFichero.class b/bin/Package/HolaFichero.class new file mode 100644 index 0000000..86d545b Binary files /dev/null and b/bin/Package/HolaFichero.class differ diff --git a/bin/module-info.class b/bin/module-info.class new file mode 100644 index 0000000..e28b582 Binary files /dev/null and b/bin/module-info.class differ diff --git a/src/Package/HolaFichero.java b/src/Package/HolaFichero.java new file mode 100644 index 0000000..9675905 --- /dev/null +++ b/src/Package/HolaFichero.java @@ -0,0 +1,49 @@ +package Package; +import java.io.File; +import java.io.IOException; +public class HolaFichero { + + static char Sistema; + + public static void main(String args[]) { + char Sistema=MiSistema(); + System.out.println(Sistema); + + } + + static char MiSistema() { + char Sis='?'; + char Windows='W'; + char Linux='L'; + System.out.println("Creando mi primer fichero ..."); + String so = System.getProperty("os.name"); + System.out.print("El sistema operativo es: "); + if (so.charAt(0)==Windows) { + System.out.print("Windows -> "); + Sis=Windows; + } + else { + System.out.print("Linux -> "); + Sis=Linux; + } + return Sis; + } + + public void CreoFicheroWindows() throws IOException { + System.out.println("Creando fichero en Windows ..."); + File fwindows = new File("C:\\Users\\Ivan\\Documents\\CreoFicheroWindows.txt"); + if (!fwindows.exists()) { + fwindows.createNewFile(); + } + System.out.println("Fichero creado en Windows."); + } + + public void CreoFicheroLinux() throws IOException { + System.out.println("Creando fichero en Linux ..."); + File funix = new File("/home/..../CreoFicheroUnix.txt"); + if (!funix.exists()) { + funix.createNewFile(); + } + System.out.println("Fichero creado en Unix."); + } +} diff --git a/src/module-info.java b/src/module-info.java new file mode 100644 index 0000000..1b5ee1d --- /dev/null +++ b/src/module-info.java @@ -0,0 +1,9 @@ +/** + * + */ +/** + * @author Ivan + * + */ +module HolaFichero { +} \ No newline at end of file