how can I import a file in java programming language

前端 未结 3 1893
面向向阳花
面向向阳花 2021-01-29 11:48

how can I import a file in java programming language

相关标签:
3条回答
  • 2021-01-29 12:24

    Take a look at Packages:

    • http://tinf2.vub.ac.be/~dvermeir/java/other_doc/JavaPackages.html
    • http://java.sun.com/docs/books/tutorial/java/package/packages.html
    0 讨论(0)
  • 2021-01-29 12:25

    If by import a file you meant read a file, there are several ways, probably the most common of which are using the Scanner and BufferedReader objects. Have a look at
    http://java.sun.com/javase/6/docs/api/java/util/Scanner.html
    and
    http://java.sun.com/javase/6/docs/api/java/io/BufferedReader.html
    respectively for information on how to use them.

    0 讨论(0)
  • 2021-01-29 12:37

    You don't import files in Java. You import classes.

    The syntax is as follows:

    import com.my.Class;
    

    There is nothing like the #include available in C/C++. If you really want to actually "include" files into your source, you need to rethink your design.

    0 讨论(0)
提交回复
热议问题