Topic: 大虾们!帮一下忙.(should be declared in a file named ...)

  Print this page

1.大虾们!帮一下忙.(should be declared in a file named ...) Copy to clipboard
Posted by: hulizhong
Posted on: 2005-04-17 13:19

package firstword;
import java.net.*;
import javax.net.*;
import java.io.*;
public class Communication extends Thread{
int indata ,outdata;
char buffer[]=new char[8192];
public Communication() {
try{
Socket csocket = new Socket(jTextArea3.getText(),80);
BufferedReader in =new BufferedReader(new BufferedInputStream(csocket.getInputStream()));
PrintWriter out = new PrintWriter(csocket.getOutputStream());
}catch(IOException e){ }
}

public void run(){
while(true){
indata =in.read(buffer);
if(indata==-1)
break;
}//end while
String indata_s=new String(buffer);
jTextArea2.append("服务器端:"+indata);
}//end run
Communication communication=new Communication();
}

以上是我用JBuilder编写的一部分程序.public class Communication extends Thread. public上一个提示:class Communication is public,should be decleared in a file named Communication.程序中我不是已经说明了是public了吗.
为什么会出现上述警告啊?谢谢解答.

2.Re:大虾们!帮一下忙.(should be decleared in a file named ...) [Re: hulizhong] Copy to clipboard
Posted by: why
Posted on: 2005-04-17 13:26

Is your java file's name Communication.java ?

3.Re:大虾们!帮一下忙.(should be decleared in a file named ...) [Re: hulizhong] Copy to clipboard
Posted by: hulizhong
Posted on: 2005-04-17 13:35

是啊
斑竹,能用QQ交流吗.我的QQ是81452743

4.Re:大虾们!帮一下忙.(should be decleared in a file named ...) [Re: hulizhong] Copy to clipboard
Posted by: why
Posted on: 2005-04-17 13:42

I don't have QQ and I've never used any sort of ICQ.Embaressed

5.Re:大虾们!帮一下忙.(should be decleared in a file named ...) [Re: hulizhong] Copy to clipboard
Posted by: hulizhong
Posted on: 2005-04-17 13:44


那算了吧
上面的警告怎么解决啊

6.Re:大虾们!帮一下忙.(should be decleared in a file named ...) [Re: hulizhong] Copy to clipboard
Posted by: bujinwang
Posted on: 2005-04-17 13:50

Rename your file to: Communication.java and you should be fine.

7.Re:大虾们!帮一下忙.(should be decleared in a file named ...) [Re: hulizhong] Copy to clipboard
Posted by: hulizhong
Posted on: 2005-04-17 13:55

文件的名字就是Communication.java啊


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923