Topic: 请问这道题怎么老是编译出错

  Print this page

1.请问这道题怎么老是编译出错 Copy to clipboard
Posted by: revo1021
Posted on: 2005-10-28 11:28

import java.util.*;
public class Tythis{
  Tythis(){
    System.out.println("此函数已经被构建");
  }
  void pick(){
    System.out.println("呵呵");
  }
  void prt(){
    pick();
    System.out.println("ddsdf");
    this.pick();
  }
  public static void main(String[] args){
    prt a=new prt();
  }
  }

2.Re:请问这道题怎么老是编译出错 [Re: revo1021] Copy to clipboard
Posted by: JavaandC
Posted on: 2005-10-28 12:18

你的程序写错了,修改成(注释的语句是错误的):

//import java.util.*;这个import语句没有任何作用。

public class Tythis{
Tythis(){
System.out.println("此函数已经被构建");
}
void pick(){
System.out.println("呵呵");
}
void prt(){
pick();
System.out.println("ddsdf");
this.pick();
}
public static void main(String[] args){
//prt a=new prt(); 这句是错误的。

  Tythis a=new Tythis();
  a.prt();
}
}

输出结果:
此函数已经被构建
呵呵
ddsdf
呵呵

3.Re:请问这道题怎么老是编译出错 [Re: revo1021] Copy to clipboard
Posted by: revo1021
Posted on: 2005-10-28 13:57

谢谢你,楼上的前辈,谢谢啊


   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