找不到符号 sleep(int) & printen(int)
can't find symbol sleep(int) & printen(int)
我需要有关 Sleep() 和 printen() 的帮助
import java.util.*;
public class example
{
public static void main(String[]args)
{
int i = 1;
int a = 4;
while( i < 4 )
{
i++;
a--;
sleep(1000);
System.out.println("\t\t\t\t The Game Begins In...");
System.out.print("\t\t\t\t " + a);
}
}
}
我遇到错误
cannot find symbol
symbol : method sleep(int)
location: class example
sleep(1000);
请帮我解决这个问题
import java.util.*;
public class example
{
public static void main(String[]args)
{
int i = 1;
int a = 4;
while( i < 4 )
{
i++;
a--;
try {
// thread to sleep for 1000 milliseconds
Thread.sleep(100);
} catch (Exception e) {
System.out.println(e);
}
System.out.println("\t\t\t\t The Game Begins In...");
System.out.print("\t\t\t\t " + a);
}
}
}
Output
The Game Begins In...
3 The Game Begins In...
2 The Game Begins In...
1
我需要有关 Sleep() 和 printen() 的帮助
import java.util.*;
public class example
{
public static void main(String[]args)
{
int i = 1;
int a = 4;
while( i < 4 )
{
i++;
a--;
sleep(1000);
System.out.println("\t\t\t\t The Game Begins In...");
System.out.print("\t\t\t\t " + a);
}
}
}
我遇到错误
cannot find symbol
symbol : method sleep(int)
location: class example
sleep(1000);
请帮我解决这个问题
import java.util.*;
public class example
{
public static void main(String[]args)
{
int i = 1;
int a = 4;
while( i < 4 )
{
i++;
a--;
try {
// thread to sleep for 1000 milliseconds
Thread.sleep(100);
} catch (Exception e) {
System.out.println(e);
}
System.out.println("\t\t\t\t The Game Begins In...");
System.out.print("\t\t\t\t " + a);
}
}
}
Output
The Game Begins In...
3 The Game Begins In...
2 The Game Begins In...
1