关于一个简单的java问题

2025年03月18日 04:40
有3个网友回答
网友(1):

class gp14 编写有问题,System.out.println(text.go);此中text没有定义。new text();
new text();这两个new的对象,不懂你想表达什么

网友(2):

错误代码提示补贴出来还要大家帮你跑一遍吗?

网友(3):

不知道你是不是要这样的效果
class gp14
{
static int count=1;
static void go()
{
System.out.println("ok");
}
public gp14()
{
count++;
System.out.println(count);
}
}
public class text
{
public static void main(String args[])
{
gp14 gp=new gp14();
new text();
new text();
gp.go();

}
}