小编Lam*_*ine的帖子

os.O_TRUNC 有什么作用?

func OpenFile(name string, flag int, perm FileMode) (*File, error)

f, err := os.OpenFile("notes.txt", os.O_RDWR|os.O_CREATE|O_TRUNC, 0755)
Run Code Online (Sandbox Code Playgroud)

“O_TRUNC”是否在写入前清空整个文件?“截断”是什么意思?

另外,该函数ioutil.WriteFile()在写入之前是否清空了整个文件?

module function func writefile go

4
推荐指数
1
解决办法
2335
查看次数

为什么我的 java 代码中的 equals 返回 false?

我不明白为什么equals()在我的代码中返回“false”而不是“true”?

class Location {

    private int x, y;

    public Location(int x, int y) {

        this.x = x;
        this.y = y;
    }
}

public class App {

    public static void main(String[] args) {

        Location a = new Location(1, 2); //
        Location b = new Location(1, 2); // same values

        System.out.println(a.equals(b)); // result : "false"
    }
}
Run Code Online (Sandbox Code Playgroud)

如何比较两个对象的值?

java equals

0
推荐指数
1
解决办法
147
查看次数

标签 统计

equals ×1

func ×1

function ×1

go ×1

java ×1

module ×1

writefile ×1