河南成教 / Java程序设计
阅读下列程序,写出程序运行结果。
import java.util.*;
public class Class3304
{
public static void main(String[] args)
{
String s1="public,static?void,main";
StringTokenizer pas1=new StringTokenizer(s1,"? ,");
int n1=pas1.countTokens();
System.out.println(n1);
while(pas1.hasMoreTokens())
{
String s=pas1.nextToken();
System.out.println(s);
}
}
}
import java.util.*;
public class Class3304
{
public static void main(String[] args)
{
String s1="public,static?void,main";
StringTokenizer pas1=new StringTokenizer(s1,"? ,");
int n1=pas1.countTokens();
System.out.println(n1);
while(pas1.hasMoreTokens())
{
String s=pas1.nextToken();
System.out.println(s);
}
}
}
参考答案:
佳题速递: