如下代码在Josephu_table table=new Josephu_table(head);编译时报少了一个“;”,各位大侠帮忙看看怎么回事,谢谢!
/**
*@author dccb-zhouxc
*@功能 使用静态属性实现计数
*/
package com.study;
import java.io.*;public class Josephu { /**
* @param args
*/
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
InputStreamReader isr= new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(isr);
System.out.println("请输入组员姓名");
String a1=br.readLine();
Person head=new Person(a1);
Josephu_table table=new Josephu_table(head);
}}
class Person{
String name;
Person next;
public Person(String a1) {
this.name=name;
}
}/**
* @功能 约瑟夫单向循环链表类
*
* */
class Josephu_table{
Person head;
public Josephu_table(Person a2){
this.head=a2;
this.head.next=a2;
System.out.println(this.head.name);
}
void join_Josephu(Person new_Person){
Person person_pointer=head;
new_Person.next=head; while(person_pointer.next!=head){
person_pointer=person_pointer.next;
}
person_pointer.next=new_Person;
}
}
/**
*@author dccb-zhouxc
*@功能 使用静态属性实现计数
*/
package com.study;
import java.io.*;public class Josephu { /**
* @param args
*/
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
InputStreamReader isr= new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(isr);
System.out.println("请输入组员姓名");
String a1=br.readLine();
Person head=new Person(a1);
Josephu_table table=new Josephu_table(head);
}}
class Person{
String name;
Person next;
public Person(String a1) {
this.name=name;
}
}/**
* @功能 约瑟夫单向循环链表类
*
* */
class Josephu_table{
Person head;
public Josephu_table(Person a2){
this.head=a2;
this.head.next=a2;
System.out.println(this.head.name);
}
void join_Josephu(Person new_Person){
Person person_pointer=head;
new_Person.next=head; while(person_pointer.next!=head){
person_pointer=person_pointer.next;
}
person_pointer.next=new_Person;
}
}
* @param args
*/
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stubInputStreamReader isr= new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(isr);
System.out.println("请输入组员姓名");
String a1=br.readLine();
Person head=new Person(a1);
Josephu_table table=new Josephu_table(head);
}}
class Person{
String name;
Person next;
public Person(String a1) {
this.name=name;
}
}/**
* @功能 约瑟夫单向循环链表类
*
* */
class Josephu_table{
Person head;
public Josephu_table(Person a2){
this.head=a2;
this.head.next=a2;
System.out.println(this.head.name);
}void join_Josephu(Person new_Person){
Person person_pointer=head;
new_Person.next=head;while(person_pointer.next!=head){
person_pointer=person_pointer.next;
}
person_pointer.next=new_Person;
}}输入
a
null