Loading [MathJax]/jax/output/CommonHTML/config.js
首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >java file报错?

java file报错?

提问于 2018-09-04 03:37:28
回答 1关注 0查看 528

public class File { private static final String filepath="F:/java/图书管理/src/图书管理/ziyuan"; public static final String shuxingfenge=",";//定义一个属性的分割符, public static void wtitetofile(Book...books){ if(books==null)return; File bookfile=new File(filepath);}//这里报错,显示:构造函数 File(String)未定义

以前没有问题

已邀请
等3人回答

回答 1

Rekent

发布于 2018-09-04 07:56:07

代码语言:javascript
运行
AI代码解释
复制
import java.io.File;

你的类名也是File,引用了你的自己写的当前类型,所以会提示缺少构造函数,应避免同名的情况出现,建议改成MyFile

和开发者交流更多问题细节吧,去 写回答
相关文章
elasticsearch 安装插件报错 java.nio.file.NotDirectoryException
安装插件时直接将插件的zip解压到了 plugins目录 导致的,每个插件应以目录的形式存放在 plugins目录 中
Amadeus
2023/03/16
1.9K0
PyInstaller关于No such file or directory报错
No such file or directory: 'C:\\Users\\BJ7K8F3\\AppData\\Local\\Temp\\_MEI91362\\xxx\\yyy'
Elsa_阿尼
2021/07/21
5.1K1
PyInstaller关于No such file or directory报错
Xcode报错: The file couldn't be opened
有位同学给了我一份代码,通过GitHub。下载之后怎么都打不开,总是提示“The file couldn't be opened”。
stanbai
2018/08/13
3.7K0
Xcode报错: The file couldn't be opened
java file 文件操作 operate file of java
java文件操作 1 package com.b510; 2 3 import java.io.File; 4 import java.io.FileInputStream; 5 import java.io.FileOutputStream; 6 import java.io.FileWriter; 7 import java.io.InputStream; 8 import java.io.PrintWriter; 9 10 /** 11 * 12 *
Hongten
2018/09/13
8090
JAVA实现微信退款报错unexpected end of file from server
前几天做了微信扫码支付,同事说把退款接口也做了吧,然后就根据申请退款文档,把支付的方法拿过来用了,结果抛出了这样一个问题 unexpected end of file from server
小柒2012
2018/04/16
1.2K0
JAVA实现微信退款报错unexpected end of file from server
CentOS 报错cannot execute binary file
在安装软件过程中执行文件,报错cannot execute binary file
JaneYork
2023/10/11
1.8K0
CentOS 报错cannot execute binary file
MapReduce报错:「MKDirs failed to create file」
MapReduce报错:「MKDirs failed to create file」 0. 写在前面 1. 程序代码及报错信息 输入、输出路径 程序代码 报错信息 2. 查找资料 3. 原因分析 4. 参考 ---- ---- 0. 写在前面 Linux:Ubuntu Kylin16.04 Hadoop:Hadoop2.7.2 1. 程序代码及报错信息 输入、输出路径 zhangsan@hadoop01:/$ ll | grep input drwxr-xr-x 3 zhangsan zhang
WHYBIGDATA
2023/01/31
4590
MapReduce报错:「MKDirs failed to create file」
Java基础——File
File是IO包中唯一表示文件和磁盘目录的对象的路径.包含了创建,删除,重命名,获取文件信息等. 构造函数
羊羽shine
2019/05/28
4580
cadvisor 运行报错/sys/fs/cgroup/cpuacct,cpu: no such file or directory
运行docker监控容器cadvisor的时候提示如下错误 Dec 13 17:36:39 prd_java-cc8 dockerd-current[2586]: W1213 17:36:39.185606 1 manager.go:349] Could not configure a source for OOM detection, disabling OOM events: open /dev/kmsg: no such file or directory Dec 13 17:36:39
张琳兮
2022/01/12
2K0
Java File类
把视频名全部重命名 把E:\java目录下所有以java结尾的绝对路径输出控制台
Tim在路上
2020/08/04
9120
Java File 文件
package expression; import java.io.File; public class Demo{ public static void main(String[] args){ /* * 项目下的路径(默认路径):word.txt * 包中的文件路径(和类在一起的):src/expression/word1.txt * 注意 / 和 \\表示文件夹,以上两个都是抽象路径 * * 绝对路径:C:\\text\\word.tx
用户2965768
2019/01/28
7180
Java File 文件
java读写file
private static String encoding = "utf-8"; public static void readTxt(String filePath) throws IOException { File file = new File(filePath); if (file.isFile() && file.exists()) { InputStreamReader read = new InputStreamReade
Ryan-Miao
2018/03/13
8260
Java File文件
使用File对象,我们可以创建新文件,删除现有文件,重命名文件,更改文件的权限等。
乐心湖
2020/07/31
5050
PyCharm在Linux安装出现报错-Java Runtime (class file version 55.0)
在Linux桌面下安装PyCharm的时候出现如下报错 root@ubuntu:~# cd pycharm-community-2021.1.1 root@ubuntu:~/pycharm-community-2021.1.1# ls bin classpath.txt Install-Linux-tar.txt license brokenPlugins.db help jbr plugins build
小陈运维
2021/10/13
2.1K0
解决报错libssl.so.1.1: cannot open shared object file: No such file or directory
Centos7默认提供的openssl版本是1.0.2的,某些php扩展或者其他软件依赖1.1以上版本
沈唁
2020/03/23
33.4K2
解决报错libssl.so.1.1: cannot open shared object file: No such file or directory
React Native 运行报错 error in opening zip file
基于 React Native 中文网教程 编译并运行 React Native 应用
草帽lufei
2022/07/29
6990
supervisorctl报错unix:///tmp/supervisor.sock no such file 转
在使用supervisor进行进程管理时,启动supervisorctl,启动时候报错 unix:///tmp/supervisor.sock no such file
双面人
2019/05/21
2.6K0
dubbo 启动Failed to save registry store file报错
Can not lock the registry cache file /root/.dubbo/dubbo-registry-10.141.4.168.cache,拿不到文件锁,无法保存服务列表。
MickyInvQ
2020/09/27
3.3K0
dubbo 启动Failed to save registry store file报错
centos引入cv2报错No such file or directory
错误代码 ImportError: libXext.so.6: cannot open shared object file: No such file or directory 可通过安装qt4解决 ubuntu apt install python-qt4 #centos: yum -y install python-qt4 其他错误 ImportError:libcblas.so.3: ImportError:libjasper.so.1: image.png ImportError:li
一朵灼灼华
2022/08/05
6370
centos引入cv2报错No such file or directory
【Java】15 File 类
public File(String pathname):通过将给定的路径名字符串转换为抽象路径名来创建新的 File 实例。 public File(String parent, String child):从父路径名字符串和子路径名字符串创建新的 File 实例。 public File(File parent, String child):从父抽象路径名和子路径名字符串创建新的 File 实例。
Demo_Null
2020/09/28
5250

相似问题

相关问答用户
擅长3个领域
平安资管 | 架构师擅长4个领域
高级数据分析师擅长5个领域
擅长4个领域
腾讯云TDP | 高级后端开发工程师擅长3个领域
添加站长 进交流群

领取专属 10元无门槛券

AI混元助手 在线答疑

扫码加入开发者社群
关注 腾讯云开发者公众号

洞察 腾讯核心技术

剖析业界实践案例

扫码关注腾讯云开发者公众号
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档