请查看下面的代码:
// A.class
File file = new File("blah.txt");
FileWriter fileWriter = new FileWriter(file);
PrintWriter printWriter = new PrintWriter(fileWriter);
// B.class
File file = new File("blah.txt");
FileWriter fileWriter = new FileWriter(file);
BufferedWriter bWriter = new BufferedWriter(fileWriter);
Run Code Online (Sandbox Code Playgroud)
这两种方法有什么区别?
什么时候应该在BufferedWriter上使用PrintWriter?
我有一个名为"选择"的单选按钮,选项是和否.如果我选择任何一个选项并单击标有"清除"的按钮,我需要使用javascript清除所选选项.我怎么能做到这一点?
我正在使用JXL API处理应用程序,当我尝试使用eclipse IDE编译时,它工作正常,当我尝试在命令提示符下编译并显示以下异常时,同样不编译.
Extract.java:6: cannot access jxl.read.biff.BiffException bad class file: C:\Program Files\Java\jdk1.5.0_01\jre\lib\ext\jxl.jar(jxl/read/biff/BiffException.class)
class file has wrong version 50.0, should be 49.0
Please remove or make sure it appears in the correct subdirectory of the classpa
th.
import jxl.read.biff.BiffException;
^
1 error
Run Code Online (Sandbox Code Playgroud)
编辑:
我能够使用JDK 1.6执行.由于JDK 1.6还必须与较低版本兼容,为什么它不支持在JDK 1.5中编译的类文件.
new运营商和Class.forName(...).newInstance()?有什么区别?它们都创建了一个类的实例,我不确定它们之间的区别.
我有一个问题,在写入文件时,在关闭之前,我们应该包括flush()?? 如果是这样它会做什么呢?不流自动冲洗?编辑:
那么冲洗它实际上做了什么?
促销的规则是"当操作数具有不同类型时,自动二进制数字促销发生,较小的操作数类型转换为较大的".但操作数是相同类型的,例如,
byte=byte+byte // Compile time error... found int..
Run Code Online (Sandbox Code Playgroud)
那为什么会这样呢?
我想知道.properties文件的用途和使用位置是什么?目前我正在使用ANT进行动态Web应用程序,我必须使用.properties文件,并且必须在build.xml文件中设置属性.所以请提出有关这方面的想法
问候,Jeya
1)缓冲流如何在后台工作,它们与普通流有什么不同?使用它们的优点是什么?
2)DataInputStream也是以字节为基础的.但它有方法readLine().这里有什么意义?
我是maven的新手,我经历了Apache站点中给出的配置步骤,但我仍然无法配置它.所以任何人都可以通过简单的步骤来帮助我在Windows中配置MAVEN.提前致谢.
EDITED
C:\Documents and Settings\arselv>mvn install
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO] task-segment: [install]
[INFO] ------------------------------------------------------------------------
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven- resources- plugin/2.3/maven-resources-plugin-2.3.pom
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-resources- plugin/2.3/maven-resources-plugin-2.3.pom
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).
Project ID: org.apache.maven.plugins:maven-resources-plugin
Reason: POM 'org.apache.maven.plugins:maven-resources-plugin' not found in repository: Unable to download the artifact from any repository
org.apache.maven.plugins:maven-resources-plugin:pom:2.3
from the specified remote repositories:
central (http://repo1.maven.org/maven2)
for project org.apache.maven.plugins:maven-resources-plugin
[INFO] ------------------------------------------------------------------------
[INFO] For more …Run Code Online (Sandbox Code Playgroud) java ×8
stream ×3
exception ×1
file ×1
filereader ×1
filewriter ×1
flush ×1
html ×1
java-io ×1
javascript ×1
jxl ×1
maven-2 ×1
new-operator ×1
reflection ×1