求助!麻烦各位大虾帮我解决一下这几道JAVA题,谢啦!急~~~
1、编写一个程序,将两个Java程序文件显示到屏幕上。importjava.io.*;publicclassSequenceInputStreamDemo{publics...
1、编写一个程序,将两个Java程序文件显示到屏幕上。
import java.io.*;
public class SequenceInputStreamDemo{
public static void main(String args[]){
_______(1)___________fis1,fis2;
try{
fis1=new FileInprtStream(“prog1.java”);
fis2=new FileInprtStream(“prog2.java”);
_________(2)___________;
while((buf=________(3)_________)>0) System.out.print((char)buf);
________(4)_______;
fis2.close();
}________(5)_________{
System.out.println(e);
}
2.完成下列程序。
public class Name{
private String useName;
private String useS;
public _______(1)Name{
_______(2) useName =”whatever”; useS=”whatever”;}
public _______(3)Name (String s)
{int i=s. _______(4)___________;//搜索空格
if(_______(5)___________){
useName=s.substring(0,i);
useS=s.substring(i+1);}}}
3、定义一个Demo执行类。要求可根据客户不同要求计算出矩形、圆的周长和面积。
4、编写程序,使界面中包含3个标签,其背景分别为红、黄、蓝3色
5、实现文件的复制,并输出。 展开
import java.io.*;
public class SequenceInputStreamDemo{
public static void main(String args[]){
_______(1)___________fis1,fis2;
try{
fis1=new FileInprtStream(“prog1.java”);
fis2=new FileInprtStream(“prog2.java”);
_________(2)___________;
while((buf=________(3)_________)>0) System.out.print((char)buf);
________(4)_______;
fis2.close();
}________(5)_________{
System.out.println(e);
}
2.完成下列程序。
public class Name{
private String useName;
private String useS;
public _______(1)Name{
_______(2) useName =”whatever”; useS=”whatever”;}
public _______(3)Name (String s)
{int i=s. _______(4)___________;//搜索空格
if(_______(5)___________){
useName=s.substring(0,i);
useS=s.substring(i+1);}}}
3、定义一个Demo执行类。要求可根据客户不同要求计算出矩形、圆的周长和面积。
4、编写程序,使界面中包含3个标签,其背景分别为红、黄、蓝3色
5、实现文件的复制,并输出。 展开
4个回答
展开全部
1
(1) FileInputStream
(2) char buf;
(3) (char) fis1.read()
(4) while ((buf = (char) fis2.read()) > 0) System.out.print((char) buf);
fis1.close();
(5)catch (FileNotFoundException e)
你题目抄的有点问题 附上可执行源码
public class SequenceInputStreamDemo {
public static void main(String[] args) {
// _______(1)___________fis1,fis2;
FileInputStream fis1, fis2;
try {
fis1 = new FileInputStream("prog1.java");
fis2 = new FileInputStream("prog2.java");
// _________(2)___________;
char buf;
// while((buf=________(3)_________)>0) System.out.print((char)buf);
while ((buf = (char) fis1.read()) > 0) System.out.print((char) buf);
// ________(4)_______;
while ((buf = (char) fis2.read()) > 0) System.out.print((char) buf);
fis1.close();
fis2.close();
// }________(5)_________{
} catch (FileNotFoundException e) {
System.out.println(e);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
2
(1) 什么也不填
(2) super();
(3) 什么也不填
(4) .indexOf(" ");
(5)i > 0
可执行代码:
public class Name {
private String useName;
private String useS;
// public _______(1)Name{
public Name() {
// _______(2) useName =”whatever”; useS=”whatever”;}
super();
useName = "whatever";
useS = "whatever";
}
// public _______(3)Name (String s)
public Name(String s) {
// {int i=s. _______(4)___________;//搜索空格
int i = s.indexOf(" ");
// if(_______(5)___________){
if (i > 0) {
useName = s.substring(0, i);
useS = s.substring(i + 1);
}
}
}
(1) FileInputStream
(2) char buf;
(3) (char) fis1.read()
(4) while ((buf = (char) fis2.read()) > 0) System.out.print((char) buf);
fis1.close();
(5)catch (FileNotFoundException e)
你题目抄的有点问题 附上可执行源码
public class SequenceInputStreamDemo {
public static void main(String[] args) {
// _______(1)___________fis1,fis2;
FileInputStream fis1, fis2;
try {
fis1 = new FileInputStream("prog1.java");
fis2 = new FileInputStream("prog2.java");
// _________(2)___________;
char buf;
// while((buf=________(3)_________)>0) System.out.print((char)buf);
while ((buf = (char) fis1.read()) > 0) System.out.print((char) buf);
// ________(4)_______;
while ((buf = (char) fis2.read()) > 0) System.out.print((char) buf);
fis1.close();
fis2.close();
// }________(5)_________{
} catch (FileNotFoundException e) {
System.out.println(e);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
2
(1) 什么也不填
(2) super();
(3) 什么也不填
(4) .indexOf(" ");
(5)i > 0
可执行代码:
public class Name {
private String useName;
private String useS;
// public _______(1)Name{
public Name() {
// _______(2) useName =”whatever”; useS=”whatever”;}
super();
useName = "whatever";
useS = "whatever";
}
// public _______(3)Name (String s)
public Name(String s) {
// {int i=s. _______(4)___________;//搜索空格
int i = s.indexOf(" ");
// if(_______(5)___________){
if (i > 0) {
useName = s.substring(0, i);
useS = s.substring(i + 1);
}
}
}
展开全部
一
1 FileInputStream
2 char buf;
3 fis2.read();
4 fis1.close();
1 FileInputStream
2 char buf;
3 fis2.read();
4 fis1.close();
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
1、FileInprtStream
2、char buf
3、fis1.next||fis2.next
4、fis1.close()
catch(Exception e)
1、void
2、
3、void
4、split(" ")
5、i!=-1
2、char buf
3、fis1.next||fis2.next
4、fis1.close()
catch(Exception e)
1、void
2、
3、void
4、split(" ")
5、i!=-1
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2010-06-03
展开全部
public class Name{
private String useName;
private String useS;
public _______(1)Name{
_______(2) useName =”whatever”; useS=”whatever”;}
public _______(3)Name (String s)
{int i=s. _______(4)___________;//搜索空格
if(_______(5)___________){
useName=s.substring(0,i);
useS=s.substring(i+1);}}}
private String useName;
private String useS;
public _______(1)Name{
_______(2) useName =”whatever”; useS=”whatever”;}
public _______(3)Name (String s)
{int i=s. _______(4)___________;//搜索空格
if(_______(5)___________){
useName=s.substring(0,i);
useS=s.substring(i+1);}}}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询