Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
傅伟强-富德
/
test1
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 2d8e6c3e
authored
May 06, 2018
by
傅伟强-富德
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Test.java
1 parent
9b4b6042
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
48 deletions
src/Test.java
src/Test.java
View file @
2d8e6c3
import
java.io.BufferedReader
;
import
java.io.BufferedReader
;
import
java.io.BufferedWriter
;
import
java.io.BufferedWriter
;
import
java.io.File
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileInputStream
;
import
java.io.FileNotFoundException
;
import
java.io.FileNotFoundException
;
import
java.io.FileWriter
;
import
java.io.FileWriter
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
import
java.io.InputStreamReader
;
public
class
Test
{
public
class
Test
{
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
test1
();
test1
();
}
}
public
static
void
test1
(){
public
static
void
test1
(){
String
param
=
"1225sddfh"
;
String
param
=
"1225sddfh"
;
System
.
out
.
println
(
param
.
substring
(
0
,
1
));
System
.
out
.
println
(
param
.
substring
(
0
,
1
));
int
s
=
param
.
length
();
int
s
=
param
.
length
();
System
.
out
.
println
(
s
);
System
.
out
.
println
(
s
);
}
}
public
static
void
reader
()
throws
IOException
{
public
static
void
reader
()
throws
IOException
{
File
fileName
=
new
File
(
"D:\\test.txt"
);
File
fileName
=
new
File
(
"D:\\test.txt"
);
try
{
try
{
fileName
.
createNewFile
();
fileName
.
createNewFile
();
BufferedWriter
bWriter
=
new
BufferedWriter
(
new
FileWriter
(
fileName
));
BufferedWriter
bWriter
=
new
BufferedWriter
(
new
FileWriter
(
fileName
));
bWriter
.
write
(
"
哈哈哈哈"
);
bWriter
.
write
(
"
哈哈哈哈呵呵呵呵"
);
bWriter
.
flush
();
bWriter
.
flush
();
bWriter
.
close
();
bWriter
.
close
();
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
// TODO Auto-generated catch block
// TODO Auto-generated catch block
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
InputStreamReader
reader
=
new
InputStreamReader
(
InputStreamReader
reader
=
new
InputStreamReader
(
new
FileInputStream
(
fileName
));
//
建立一个输入流对象reader
new
FileInputStream
(
fileName
));
//
建立一个输入流对象reader
BufferedReader
br
=
new
BufferedReader
(
reader
);
//
建立一个对象,它把文件内容转成计算机能读懂的语言
BufferedReader
br
=
new
BufferedReader
(
reader
);
//
建立一个对象,它把文件内容转成计算机能读懂的语言
String
line
=
""
;
String
line
=
""
;
line
=
br
.
readLine
();
line
=
br
.
readLine
();
while
(
line
!=
null
)
{
while
(
line
!=
null
)
{
line
=
br
.
readLine
();
//
一次读入一行数据
line
=
br
.
readLine
();
//
一次读入一行数据
}
}
System
.
out
.
println
(
line
);
System
.
out
.
println
(
line
);
}
}
}
}
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment