Top Menu

Jump to content
Home
    • Projects
    • Work packages
    • News
    • Getting started
    • Introduction video
      Welcome to OpenProject
      Get a quick overview of project management and team collaboration with OpenProject. You can restart this video from the help menu.

    • Help and support
    • Upgrade to Enterprise edition
    • User guides
    • Videos
    • Shortcuts
    • Community forum
    • Professional support

    • Additional resources
    • Data privacy and security policy
    • Digital accessibility (DE)
    • OpenProject website
    • Security alerts / Newsletter
    • OpenProject blog
    • Release notes
    • Report a bug
    • Development roadmap
    • Add and edit translations
    • API documentation
  • Sign in
      Create a new account
      Forgot your password?

Side Menu

  • Overview
  • News
  • Forums
  • Wiki
    • Table of contents
      • Expanded. Click to collapseCollapsed. Click to showWiki
        • Expanded. Click to collapseCollapsed. Click to showBeispielprojekte
          • Hierarchy leafFlappy Box2D
          • Hierarchy leafFlappy Improved
          • Hierarchy leafHighscore Hibernate
          • Hierarchy leafHighscore Webservice + Anbindung mit Retrofit
        • Expanded. Click to collapseCollapsed. Click to showEntwicklung mit Java
          • Hierarchy leaf001) Grundlagen - Entwicklungsumgebung
          • Hierarchy leaf002) Erstes Programm
          • Hierarchy leaf003) Variablen und Datentypen
          • Expanded. Click to collapseCollapsed. Click to show004) Schleifen
            • Hierarchy leaf1) for - Zählschleife
            • Hierarchy leaf2) while
            • Hierarchy leaf3) do while
            • Hierarchy leaf4) for each
          • Hierarchy leaf005) Arrays
          • Hierarchy leaf006) Methoden
          • Expanded. Click to collapseCollapsed. Click to show007) Objektorientierte Programmierung
            • Hierarchy leaf001) Klasse
            • Hierarchy leaf002) Vererbung und Darstellung von Klassen in UML
            • Hierarchy leaf003) Abstrakte Klasse
            • Hierarchy leaf004) Design patterns
          • Expanded. Click to collapseCollapsed. Click to show008) Webservices
            • Hierarchy leaf01) REST - Representational State Transfer
            • Hierarchy leaf02) Minimaler Webservice
            • Hierarchy leaf03) Joke Webservice
            • Hierarchy leaf04) Highscore Service
        • Expanded. Click to collapseCollapsed. Click to showMatura - Vorbereitung
          • Hierarchy leaf01) Projektmanagement
          • Hierarchy leaf02) Objektorientierte Programmierung
          • Hierarchy leaf03) Modellierung und UML
          • Expanded. Click to collapseCollapsed. Click to show04) Design Patterns
            • Hierarchy leaf00) Generelle Konzepte
            • Hierarchy leafFactory(-Method) Pattern
            • Hierarchy leafObserver Pattern
            • Hierarchy leafSingleton Pattern
            • Hierarchy leafStrategy Pattern
          • Hierarchy leaf05) Algorithmen und Datenstrukturen
          • Hierarchy leaf06) Webtechnologien
          • Hierarchy leaf07) Webservices
          • Hierarchy leaf08) Softwarequalitätsmanagement
          • Hierarchy leaf09) Softwareentwicklungsmodelle
        • Expanded. Click to collapseCollapsed. Click to showProjekt Rahmenbedingungen
          • Expanded. Click to collapseCollapsed. Click to showRetrospektive
            • Hierarchy leafRetro - [Name Schüler_in]
        • Hierarchy leafReact Native
        • Expanded. Click to collapseCollapsed. Click to showÜbungen
          • Hierarchy leaf1) Basic
          • Expanded. Click to collapseCollapsed. Click to show2) Basic
            • Hierarchy leaf001) Methode ohne Rückabewert mit Parametern
            • Hierarchy leaf002) Methode mit Parametern und Rückgabewert
            • Hierarchy leaf003) Text umdrehen
            • Hierarchy leaf004) Text umdrehen 2
            • Hierarchy leaf005) Kommandozeile
            • Hierarchy leaf006) Kommandozeile 2
            • Hierarchy leaf007) Vererbung - Geometry
            • Hierarchy leaf008) File from String
            • Hierarchy leaf009) Rekursion - Summe
            • Hierarchy leaf010) Rekursion - File
          • Expanded. Click to collapseCollapsed. Click to showDatenstrukturen
            • Hierarchy leaf011) Binärbaum
            • Hierarchy leaf012) Binärbaum - Generics
            • Hierarchy leaf013) AVL - Tree
            • Hierarchy leaf014) Linked List - Einfach verkettete Liste
            • Hierarchy leaf015) Graph
            • Hierarchy leaf016) Dijkstras shortest path first
          • Expanded. Click to collapseCollapsed. Click to showJava - Kara
            • Hierarchy leafKara lernt schreiben
You are here:
  • Wiki
  • Übungen
  • 2) Basic
  • 008) File from String

Content

008) File from String

  • More
    • Print
    • Table of contents

Um was geht es?

Hier soll ein Programm geschrieben werden welches als Kommandozeilenargument den Pfad einer Datei erhält. Dannach soll der Dateiname, die Dateigröße und das Änderungsdatum ausgegeben werden.

Aufgabe

  • Erstelle das Package at.htldornbirn.swp.uebungen.files in src
  • Erstelle die Klasse Files mit der main Methode im files Package
  • Erstelle aus dem ersten Parameter des String Arrays der an die main Methode übergeben wird ein File
    • Das geht indem du eine neue File Instanz machst und dieser den Wert des Arrays an der Stelle 0 übergibst
  • Verwende nun dieses File um folgendes auszugeben:
    • Dateiname
    • Dateigröße
    • Änderungsdatum
  • Erstelle die Methode printUsage() und rufe diese Auf wenn keine Kommandozeilenargumente übergeben wurden und beende das Programm (siehe 006) Kommandozeile 2)
  • Starte und teste dein Programm in der Kommandozeile (siehe 005) Kommandozeile)
Loading...