File类的构造方法介绍
2020-01-15 11:55
225 查看
File类的构造方法介绍
package com.file; import java.io.File; import org.junit.Test; /* * File类的构造方法介绍 * 文件路径分类: * 1)相对路径:相对某个特定位置而言 * 2)绝对路径:带有盘符c:\(Windows操作系统)或/(Linux操作系统)的路径 * E:\帮助文档\jdk\JDK_1_8_CN.chm * 1. File(String pathname) * 2. File(String parent, String child) * 3. File(File parent, String child) */ public class FileTest1 { // File(File parent, String child) @Test public void test3() { File file = new File(new File("d:\\"), "xxx.txt"); System.out.println(file); } // File(String parent, String child) @Test public void test2() { File file = new File("d:\\", "xxx.txt"); System.out.println(file); } // File(String pathname) @Test public void test1() { File file = new File("xxx.txt"); // 相对路径 file = new File("d:\\xxx.txt"); // 绝对路径 System.out.println(file); } }
- 点赞
- 收藏
- 分享
- 文章举报
相关文章推荐
- java基础:类与对象,构造方法的介绍
- IO流_File类的概述和构造方法
- JAVA初级(六)对象和类(1)基础介绍和使用,构造方法介绍
- File类的构造方法以及常用方法
- PHP的构造方法,析构方法和this关键字详细介绍
- 黑马程序员-15-java基础-面向对象(1)-概念介绍与类、对象、构造方法
- day12今日内容介绍 1、构造方法 2、this关键字 3、super关键字
- Java_基础—File类的概述和构造方法
- 6.1面向对象(介绍,类与对象,封装,this关键字,构造方法,static关键字)
- 黑马程序员--转换流对象,输出方向,转换流编码效果,字符的编码和解码,String类的构造,方法getBytes,指定编码表,File类
- Java图形界面基础实战项目讲解以及构造方法的介绍
- (十六)Core Java 枚举的使用(基本介绍,构造方法枚举,抽象方法枚举) (113)
- 【C#基础】方法及其调用、构造方法、out与ref参数及其返回值、方法重载、静态方法等简单介绍
- PHP的构造方法,析构方法和this关键字详细介绍
- 构造方法、封装、关键字(this、static)和代码块的介绍
- IO操作、File类概述和构造方法
- PHP的构造方法,析构方法和this关键字详细介绍
- OutMan——Objective-C中成员变量的作用域、@property和@synthesize介绍和使用、构造方法和自定义构造方法
- Intent方法 介绍和构造
- 【C#基础】方法及其调用、构造方法、out与ref参数及其返回值、方法重载、静态方法等简单介绍